Part Number Hot Search : 
2SA114 2DR2G GW40NC60 0NPBF URF1660 B1100 T7630 2SD756A
Product Description
Full Text Search
 

To Download MC68HC908RF2 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  mc68hc 9 08 rf 2 a dv an ce i nfo rma tio n hcmos microcontroller unit m 6 8h c 08m 6 0 8m68hc08 m 8 h c 0 8 m 6 8 h c mc68hc9 0 8 rf2 / d rev 1
blank
MC68HC908RF2 ? rev. 1 advance information motorola 3 MC68HC908RF2 advance information motorola reserves the right to make changes without further notice to any products herein. motorola makes no warranty, representation or guarantee regarding the suitability of its products for any particular purpose, nor does motorola assume any liability arising out of the application or use of any product or circuit, and specifically disclaims any and all liability, including without limitation consequential or incidental damages. "typical" parameters which may be provided in motorola data sheets and/or specifications can and do vary in different applications and actual performance may vary over time. all operating parameters, including "typicals" must be validated for each customer application by customer?s technical experts. motorola does not convey any license under its patent rights nor the rights of others. motorola products are not designed, intended, or authorized for use as components in systems intended for surgical implant into the body, or other applications intended to support or sustain life, or for any other application in which the failure of the motorola product could create a situation where personal injury or death may occur. should buyer purchase or use motorola products for any such unintended or unauthorized application, buyer shall indemnify and hold motorola and its officers, employees, subsidiaries, affiliates, and distributors harmless against all claims, costs, damages, and expenses, and reasonable attorney fees arising out of, directly or indirectly, any claim of personal injury or death associated with such unintended or unauthorized use, even if such claim alleges that motorola was negligent regarding the design or manufacture of the part. motorola, inc. is an equal opportunity/affirmative action employer. motorola and are registered trademarks of motorola, inc. digitaldna is a trademark of motorola, inc. ? motorola, inc., 2001
advance information MC68HC908RF2 ? rev. 1 4 motorola advance information to provide the most up-to-date information, the revision of our documents on the world wide web will be the most current. your printed copy may be an earlier revision. to verify you have the latest information available, refer to: http://www.motorola.com/mcu/ the following revision history table summarizes changes contained in this document. for your convenience, the page number designators have been linked to the appropriate location. revision history date revision level description page number(s) june, 2001 1 first bulleted paragraph under the subsection 15.6 interrupts reworded for clarity 208 revision to the description of the chxmax bit and the note that follows that description 218 17.3 absolute maximum ratings ? esd hbm and esd mm entries added 234 17.9 uhf transmitter module ? table entries and figures revised throughout 239 17.12 lvi characteristics ? v lvs and v lvr specifications updated ? low voltage reset and detection entries deleted 247 17.13 memory characteristics ? maximum value for flash page program pulses updated 248
MC68HC908RF2 ? rev. 1 advance information motorola list of sections 5 advance information ? MC68HC908RF2 list of sections section 1. general description . . . . . . . . . . . . . . . . . . . . 25 section 2. memory map . . . . . . . . . . . . . . . . . . . . . . . . . . 33 section 3. random-access memory (ram) . . . . . . . . . . 43 section 4. flash 2ts memory . . . . . . . . . . . . . . . . . . . . 45 section 5. central processor unit (cpu) . . . . . . . . . . . . 65 section 6. system integration module (sim) . . . . . . . . . 81 section 7. break module (brk) . . . . . . . . . . . . . . . . . . . 103 section 8. internal clock generator module (icg) . . . . 109 section 9. configuration register (config) . . . . . . . . 147 section 10. monitor read-only memory (mon) . . . . . . 151 section 11. computer operating properly module (cop) . . . . . . . . . . . . . . . . . . . . . . . 163 section 12. low-voltage inhibit (lvi) . . . . . . . . . . . . . . 169 section 13. input/output (i/o) ports . . . . . . . . . . . . . . . 175 section 14. keyboard/external interrupt module (kbi) . . . . . . . . . . . . . . . . . . . . . . . . 183 section 15. timer interface module (tim) . . . . . . . . . . . 197 section 16. pll tuned uhf transmitter module . . . . . 221
advance information MC68HC908RF2 ? rev. 1 6 list of sections motorola list of sections section 17. preliminary electrical specifications . . . . 233 section 18. mechanical specifications . . . . . . . . . . . . . 249 section 19. ordering information . . . . . . . . . . . . . . . . . 251
MC68HC908RF2 ? rev. 1 advance information motorola table of contents 7 advance information ? MC68HC908RF2 table of contents section 1. general description 1.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .25 1.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .25 1.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .26 1.4 mcu block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 1.5 pin assignments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .29 1.5.1 power supply pins (v dd and v ss ) . . . . . . . . . . . . . . . . . . . .29 1.5.2 oscillator pins (osc1 and osc2) . . . . . . . . . . . . . . . . . . . .30 1.5.3 external reset (rst ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 1.5.4 external interrupt pin (irq1 ) . . . . . . . . . . . . . . . . . . . . . . . .30 1.5.5 port a input/output pins (pta7, pta6/kbd6 ? pta1/kbd1, and pta0) . . . . . . . .31 1.5.6 port b input/output pins (ptb3/tclk, ptb2/tch0, ptb1, and ptb0/mclk) . . .31 1.5.7 uhf transmitter pins. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .31 section 2. memory map 2.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .33 2.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .33 2.3 input/output section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .35 2.4 monitor rom . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .42
advance information MC68HC908RF2 ? rev. 1 8 table of contents motorola table of contents section 3. random-access memory (ram) 3.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .43 3.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .43 3.3 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 section 4. flash 2ts memory 4.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .45 4.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .45 4.3 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 4.4 flash 2ts control register . . . . . . . . . . . . . . . . . . . . . . . . . .47 4.5 flash 2ts charge pump frequency control. . . . . . . . . . . . .49 4.6 flash 2ts erase operation . . . . . . . . . . . . . . . . . . . . . . . . . .49 4.7 flash 2ts program/margin read operation . . . . . . . . . . . . .50 4.8 flash 2ts block protection . . . . . . . . . . . . . . . . . . . . . . . . . .53 4.9 flash 2ts block protect register . . . . . . . . . . . . . . . . . . . . .54 4.10 embedded program/erase routines . . . . . . . . . . . . . . . . . . . .55 4.11 embedded function descriptions. . . . . . . . . . . . . . . . . . . . . . .56 4.11.1 rdvrrng routine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 4.11.2 prgrnge routine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 4.11.3 erarnge routine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 4.11.4 redprog routine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .59 4.11.5 example routine calls . . . . . . . . . . . . . . . . . . . . . . . . . . . . .60 4.12 low-power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .62 4.12.1 wait mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .62 4.12.2 stop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .63
table of contents MC68HC908RF2 ? rev. 1 advance information motorola table of contents 9 section 5. central processor unit (cpu) 5.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .65 5.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .66 5.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .66 5.4 cpu registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 5.4.1 accumulator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .67 5.4.2 index register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 5.4.3 stack pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 5.4.4 program counter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .69 5.4.5 condition code register . . . . . . . . . . . . . . . . . . . . . . . . . . .69 5.5 arithmetic/logic unit (alu) . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 5.6 low-power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .71 5.6.1 wait mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .72 5.6.2 stop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .72 5.7 cpu during break interrupts . . . . . . . . . . . . . . . . . . . . . . . . . .72 5.8 instruction set summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . .72 5.9 opcode map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .79 section 6. system integration module (sim) 6.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .81 6.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .82 6.3 sim bus clock control and generation . . . . . . . . . . . . . . . . . .85 6.3.1 bus timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .85 6.3.2 clock startup from por or lvi reset . . . . . . . . . . . . . . . . .85 6.3.3 clocks in stop mode and wait mode . . . . . . . . . . . . . . . . . . 86 6.4 reset and system initialization. . . . . . . . . . . . . . . . . . . . . . . . .86 6.4.1 external pin reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .87 6.4.2 active resets from internal sources . . . . . . . . . . . . . . . . . .88 6.4.2.1 power-on reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .89 6.4.2.2 computer operating properly (cop) reset. . . . . . . . . . .90 6.4.2.3 illegal opcode reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
advance information MC68HC908RF2 ? rev. 1 10 table of contents motorola table of contents 6.4.2.4 illegal address reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 6.4.2.5 low-voltage inhibit (lvi) reset . . . . . . . . . . . . . . . . . . . .90 6.5 sim counter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .91 6.5.1 sim counter during power-on reset . . . . . . . . . . . . . . . . .91 6.5.2 sim counter during stop mode recovery . . . . . . . . . . . . . .91 6.5.3 sim counter and reset states. . . . . . . . . . . . . . . . . . . . . . .91 6.6 program exception control. . . . . . . . . . . . . . . . . . . . . . . . . . . .92 6.6.1 interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .92 6.6.1.1 hardware interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . .94 6.6.1.2 swi instruction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .95 6.6.2 reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .95 6.6.3 break interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .95 6.6.4 status flag protection in break mode . . . . . . . . . . . . . . . . .96 6.7 low-power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .96 6.7.1 wait mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .96 6.7.2 stop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .98 6.8 sim registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .99 6.8.1 sim break status register . . . . . . . . . . . . . . . . . . . . . . . . . . 99 6.8.2 sim reset status register . . . . . . . . . . . . . . . . . . . . . . . .100 6.8.3 sim break flag control register . . . . . . . . . . . . . . . . . . . . 101 section 7. break module (brk) 7.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .103 7.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .103 7.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .103 7.4 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .104 7.4.1 flag protection during break interrupts . . . . . . . . . . . . . . .105 7.4.2 cpu during break interrupts . . . . . . . . . . . . . . . . . . . . . . .105 7.4.3 tim during break interrupts . . . . . . . . . . . . . . . . . . . . . . . .106 7.4.4 cop during break interrupts . . . . . . . . . . . . . . . . . . . . . . .106 7.5 low-power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .106 7.5.1 wait mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .106 7.5.2 stop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .106
table of contents MC68HC908RF2 ? rev. 1 advance information motorola table of contents 11 7.6 break module registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . .106 7.6.1 break status and control register . . . . . . . . . . . . . . . . . . .107 7.6.2 break address registers . . . . . . . . . . . . . . . . . . . . . . . . . .108 section 8. internal clock generator module (icg) 8.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .109 8.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .110 8.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .110 8.4 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .111 8.4.1 clock enable circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 8.4.2 internal clock generator . . . . . . . . . . . . . . . . . . . . . . . . . .113 8.4.2.1 digitally controlled oscillator . . . . . . . . . . . . . . . . . . . . . 114 8.4.2.2 modulo n divider . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .114 8.4.2.3 frequency comparator . . . . . . . . . . . . . . . . . . . . . . . . .114 8.4.2.4 digital loop filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .115 8.4.3 external clock generator . . . . . . . . . . . . . . . . . . . . . . . . . .116 8.4.3.1 external oscillator amplifier . . . . . . . . . . . . . . . . . . . . . . 116 8.4.3.2 external clock input path . . . . . . . . . . . . . . . . . . . . . . .117 8.4.4 clock monitor circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 8.4.4.1 clock monitor reference generator . . . . . . . . . . . . . . .118 8.4.4.2 internal clock activity detector . . . . . . . . . . . . . . . . . . . 121 8.4.4.3 external clock activity detector . . . . . . . . . . . . . . . . . . .121 8.4.5 clock selection circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . .122 8.4.5.1 clock selection switch. . . . . . . . . . . . . . . . . . . . . . . . . . 122 8.4.5.2 clock switching circuit. . . . . . . . . . . . . . . . . . . . . . . . . . 123 8.5 usage notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .124 8.5.1 switching clock sources . . . . . . . . . . . . . . . . . . . . . . . . . . 125 8.5.2 enabling the clock monitor . . . . . . . . . . . . . . . . . . . . . . . .126 8.5.3 clock monitor interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . .127 8.5.4 quantization error in dco output . . . . . . . . . . . . . . . . . . .127 8.5.4.1 digitally controlled oscillator . . . . . . . . . . . . . . . . . . . . . 128 8.5.4.2 binary weighted divider . . . . . . . . . . . . . . . . . . . . . . . .128 8.5.4.3 variable-delay ring oscillator . . . . . . . . . . . . . . . . . . . . 129 8.5.4.4 ring oscillator fine-adjust circuit . . . . . . . . . . . . . . . . . 129 8.5.5 switching internal clock frequencies . . . . . . . . . . . . . . . .130
advance information MC68HC908RF2 ? rev. 1 12 table of contents motorola table of contents 8.5.6 nominal frequency settling time . . . . . . . . . . . . . . . . . . .131 8.5.6.1 settling to within 15 percent . . . . . . . . . . . . . . . . . . . . .131 8.5.6.2 settling to within 5 percent . . . . . . . . . . . . . . . . . . . . . .132 8.5.6.3 total settling time . . . . . . . . . . . . . . . . . . . . . . . . . . . . .132 8.5.7 improving settling time . . . . . . . . . . . . . . . . . . . . . . . . . . .133 8.5.8 trimming frequency on the internal clock generator . . . .135 8.6 low-power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .137 8.6.1 wait mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .137 8.6.2 stop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .137 8.7 configuration register option . . . . . . . . . . . . . . . . . . . . . . . .137 8.7.1 extslow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .138 8.8 i/o registers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .138 8.8.1 icg control register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 8.8.2 icg multiplier register . . . . . . . . . . . . . . . . . . . . . . . . . . . .143 8.8.3 icg trim register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144 8.8.4 icg dco divider register . . . . . . . . . . . . . . . . . . . . . . . . .145 8.8.5 icg dco stage register . . . . . . . . . . . . . . . . . . . . . . . . . . 146 section 9. configuration register (config) 9.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .147 9.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .147 9.3 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .147 section 10. monitor read-only memory (mon) 10.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .151 10.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .151 10.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .152 10.4 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .152 10.4.1 monitor mode entry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .154 10.4.2 data format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .155 10.4.3 echoing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .156 10.4.4 break signal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .156
table of contents MC68HC908RF2 ? rev. 1 advance information motorola table of contents 13 10.4.5 commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .157 10.4.6 baud rate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .160 10.4.7 security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .160 section 11. computer operating properly module (cop) 11.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .163 11.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .164 11.3 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .164 11.4 i/o signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .165 11.4.1 cgmxclk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .165 11.4.2 stop instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .165 11.4.3 copctl write . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .166 11.4.4 power-on reset. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .166 11.4.5 internal reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .166 11.4.6 reset vector fetch. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .166 11.4.7 copd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .166 11.4.8 coprs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .166 11.5 cop control register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167 11.6 interrupts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .167 11.7 monitor mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .167 11.8 low-power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .167 11.8.1 wait mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .167 11.8.2 stop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .168 11.9 cop module during break interrupts . . . . . . . . . . . . . . . . . . .168 section 12. low-voltage inhibit (lvi) 12.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .169 12.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .169 12.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .170
advance information MC68HC908RF2 ? rev. 1 14 table of contents motorola table of contents 12.4 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .170 12.4.1 false trip protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . .171 12.4.2 short stop recovery option. . . . . . . . . . . . . . . . . . . . . . . .171 12.5 lvi status register. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .172 12.6 lvi interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .172 12.7 low-power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .172 12.7.1 wait mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .173 12.7.2 stop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .173 section 13. input/output (i/o) ports 13.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .175 13.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .175 13.3 port a . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .177 13.3.1 port a data register . . . . . . . . . . . . . . . . . . . . . . . . . . . . .177 13.3.2 data direction register a. . . . . . . . . . . . . . . . . . . . . . . . . .178 13.4 port b . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .180 13.4.1 port b data register . . . . . . . . . . . . . . . . . . . . . . . . . . . . .180 13.4.2 data direction register b . . . . . . . . . . . . . . . . . . . . . . . . .181 section 14. keyboard/external interrupt module (kbi) 14.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .183 14.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .183 14.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .184 14.4 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .184 14.4.1 external interrupt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .184 14.4.2 irq1 pin. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .188 14.4.3 kbi module during break interrupts. . . . . . . . . . . . . . . . . .189 14.4.4 keyboard interrupt pins . . . . . . . . . . . . . . . . . . . . . . . . . . .189 14.4.5 keyboard initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
table of contents MC68HC908RF2 ? rev. 1 advance information motorola table of contents 15 14.5 low-power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .192 14.5.1 wait mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .192 14.5.2 stop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .192 14.6 i/o registers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .193 14.6.1 irq and keyboard status and control register . . . . . . . .193 14.6.2 keyboard interrupt enable register . . . . . . . . . . . . . . . . . .195 section 15. timer interface module (tim) 15.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .197 15.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .198 15.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .198 15.4 pin name conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .199 15.5 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .199 15.5.1 tim counter prescaler . . . . . . . . . . . . . . . . . . . . . . . . . . . .202 15.5.2 input capture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .202 15.5.3 output compare . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .202 15.5.4 unbuffered output compare . . . . . . . . . . . . . . . . . . . . . . .202 15.5.5 buffered output compare . . . . . . . . . . . . . . . . . . . . . . . . .203 15.5.6 pulse-width modulation (pwm) . . . . . . . . . . . . . . . . . . . . .204 15.5.7 unbuffered pwm signal generation . . . . . . . . . . . . . . . . .205 15.5.8 buffered pwm signal generation . . . . . . . . . . . . . . . . . . .206 15.5.9 pwm initialization. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .207 15.6 interrupts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .208 15.6.1 low-power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .208 15.6.2 wait mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .208 15.6.3 stop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .209 15.7 tim during break interrupts . . . . . . . . . . . . . . . . . . . . . . . . . .209 15.8 i/o signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .209 15.8.1 tim clock pin (tclk) . . . . . . . . . . . . . . . . . . . . . . . . . . . .210 15.8.2 tim channel i/o pins (tch0) . . . . . . . . . . . . . . . . . . . . . .210 15.9 i/o registers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .210 15.9.1 tim status and control register . . . . . . . . . . . . . . . . . . . .211 15.9.2 tim counter registers . . . . . . . . . . . . . . . . . . . . . . . . . . . .213
advance information MC68HC908RF2 ? rev. 1 16 table of contents motorola table of contents 15.9.3 tim counter modulo registers . . . . . . . . . . . . . . . . . . . . .214 15.9.4 tim channel status and control registers . . . . . . . . . . . .214 15.9.5 tim channel registers. . . . . . . . . . . . . . . . . . . . . . . . . . . .218 section 16. pll tuned uhf transmitter module 16.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .221 16.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .222 16.3 transmitter functional description . . . . . . . . . . . . . . . . . . . . .223 16.4 phase-lock loop (pll) and local oscillator . . . . . . . . . . . . .223 16.5 rf output stage. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .224 16.6 modulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .224 16.7 microcontroller interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . .225 16.8 state machine. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .225 16.9 power management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .228 16.10 data clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228 16.11 application information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .229 16.11.1 application schematics in ook and fsk modulation . . . .229 16.11.2 complete application schematic . . . . . . . . . . . . . . . . . . . .232 section 17. preliminary electrical specifications 17.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .233 17.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .233 17.3 absolute maximum ratings . . . . . . . . . . . . . . . . . . . . . . . . . .234 17.4 functional operating range. . . . . . . . . . . . . . . . . . . . . . . . . .235 17.5 thermal characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . .235 17.6 1.8-volt to 3.3-volt dc electrical characteristics excluding uhf module . . . . . . . . . . . . . . . . . . . . . . . . . . . 236 17.7 3.0-volt dc electrical characteristics excluding uhf module . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
table of contents MC68HC908RF2 ? rev. 1 advance information motorola table of contents 17 17.8 2.0-volt dc electrical characteristics excluding uhf module . . . . . . . . . . . . . . . . . . . . . . . . . . . 238 17.9 uhf transmitter module . . . . . . . . . . . . . . . . . . . . . . . . . . . .239 17.9.1 uhf module electrical characteristics. . . . . . . . . . . . . . . . 239 17.9.2 uhf module output power measurement . . . . . . . . . . . . .244 17.10 control timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .246 17.11 internal oscillator characteristics . . . . . . . . . . . . . . . . . . . . . . 246 17.12 lvi characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247 17.13 memory characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . .248 section 18. mechanical specifications 18.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .249 18.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .249 18.3 32-pin lqfp package (case no. 873a) . . . . . . . . . . . . . . . .250 section 19. ordering information 19.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .251 19.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .251 19.3 mc order numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .251
advance information MC68HC908RF2 ? rev. 1 18 table of contents motorola table of contents
MC68HC908RF2 ? rev. 1 advance information motorola list of figures 19 advance information ? MC68HC908RF2 list of figures figure title page 1-1 MC68HC908RF2 mcu block diagram. . . . . . . . . . . . . . . . . . .28 1-2 lqfp pin assignments. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .29 1-3 power supply bypassing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 2-1 memory map. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .34 2-2 control, status, and data registers . . . . . . . . . . . . . . . . . . . . .36 4-1 flash 2ts control register (flcr). . . . . . . . . . . . . . . . . . . .47 4-2 smart programming algorithm flowchart. . . . . . . . . . . . . . . . .52 4-3 flash 2ts block protect register (flbpr) . . . . . . . . . . . . . .54 5-1 cpu registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 5-2 accumulator (a) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .67 5-3 index register (h:x) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 5-4 stack pointer (sp) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .68 5-5 program counter (pc) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .69 5-6 condition code register (ccr) . . . . . . . . . . . . . . . . . . . . . . . .69 6-1 sim block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .83 6-2 sim i/o register summary. . . . . . . . . . . . . . . . . . . . . . . . . . . .84 6-3 icg clock signals. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 6-4 external reset recovery timing . . . . . . . . . . . . . . . . . . . . . . . 87 6-5 internal reset timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .88 6-6 sources of internal reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . .88 6-7 por recovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 6-8 interrupt entry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .92 6-9 interrupt processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .93 6-10 interrupt recovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .94 6-11 interrupt recognition example . . . . . . . . . . . . . . . . . . . . . . . . .95
advance information MC68HC908RF2 ? rev. 1 20 list of figures motorola list of figures figure title page 6-12 wait mode entry timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .97 6-13 wait recovery from interrupt or break . . . . . . . . . . . . . . . . . . .97 6-14 wait recovery from internal reset. . . . . . . . . . . . . . . . . . . . . .97 6-15 stop mode entry timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .98 6-16 stop mode recovery from interrupt or break . . . . . . . . . . . . . .98 6-17 sim break status register (sbsr) . . . . . . . . . . . . . . . . . . . . .99 6-18 sim reset status register (srsr) . . . . . . . . . . . . . . . . . . . .100 6-19 sim break flag control register (sbfcr) . . . . . . . . . . . . . . 101 7-1 break module block diagram . . . . . . . . . . . . . . . . . . . . . . . . .104 7-2 i/o register summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .105 7-3 break status and control register (bscr) . . . . . . . . . . . . . .107 7-4 break address registers (brkh and brkl) . . . . . . . . . . . . .108 8-1 icg module block diagram . . . . . . . . . . . . . . . . . . . . . . . . . .112 8-2 internal clock generator block diagram . . . . . . . . . . . . . . . .113 8-3 external clock generator block diagram . . . . . . . . . . . . . . . .116 8-4 clock monitor block diagram . . . . . . . . . . . . . . . . . . . . . . . . . 119 8-5 clock selection circuit block diagram . . . . . . . . . . . . . . . . . . 122 8-6 synchronizing clock switcher circuit diagram. . . . . . . . . . . . 123 8-7 code example for switching clock sources . . . . . . . . . . . . .125 8-8 code example for enabling the clock monitor . . . . . . . . . . . .126 8-9 code example for writing ddiv and dstg . . . . . . . . . . . . . .135 8-10 icg i/o register summary. . . . . . . . . . . . . . . . . . . . . . . . . . .139 8-11 icg control register (icgcr) . . . . . . . . . . . . . . . . . . . . . . . . 141 8-12 icg multiplier register (icgmr) . . . . . . . . . . . . . . . . . . . . . . 143 8-13 icg trim register (icgtr) . . . . . . . . . . . . . . . . . . . . . . . . . . 144 8-14 icg dco divider register (icgdvr) . . . . . . . . . . . . . . . . . .145 8-15 icg dco stage register (icgdsr) . . . . . . . . . . . . . . . . . . . 146 9-1 configuration register (config). . . . . . . . . . . . . . . . . . . . . .148 10-1 monitor mode circuit. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .153 10-2 monitor data format. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .155 10-3 sample monitor waveforms . . . . . . . . . . . . . . . . . . . . . . . . . .155 10-4 read transaction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .156
list of figures MC68HC908RF2 ? rev. 1 advance information motorola list of figures 21 figure title page 10-5 break transaction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .156 10-6 monitor mode entry timing. . . . . . . . . . . . . . . . . . . . . . . . . . .161 11-1 cop block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .164 11-2 cop control register (copctl) . . . . . . . . . . . . . . . . . . . . . . 167 12-1 lvi module block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . .170 12-2 lvi status register (lvisr) . . . . . . . . . . . . . . . . . . . . . . . . . .172 13-1 i/o port register summary. . . . . . . . . . . . . . . . . . . . . . . . . . .176 13-2 port a data register (pta) . . . . . . . . . . . . . . . . . . . . . . . . . .177 13-3 data direction register a (ddra) . . . . . . . . . . . . . . . . . . . . . 178 13-4 port a i/o circuit. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .179 13-5 port b data register (ptb) . . . . . . . . . . . . . . . . . . . . . . . . . .180 13-6 data direction register b (ddrb) . . . . . . . . . . . . . . . . . . . . . 181 13-7 port b i/o circuit. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .182 14-1 irq block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .185 14-2 irq and keyboard i/o register summary . . . . . . . . . . . . . . .185 14-3 irq interrupt flowchart . . . . . . . . . . . . . . . . . . . . . . . . . . . . .187 14-4 keyboard interrupt block diagram . . . . . . . . . . . . . . . . . . . . .190 14-5 irq and keyboard status and control register (intkbscr) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193 14-6 keyboard interrupt enable register (intkbier) . . . . . . . . . .195 15-1 tim block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .200 15-2 tim i/o register summary . . . . . . . . . . . . . . . . . . . . . . . . . . .200 15-3 pwm period and pulse width . . . . . . . . . . . . . . . . . . . . . . . .204 15-4 tim status and control register (tsc) . . . . . . . . . . . . . . . . .211 15-5 tim counter registers (tcnth and tcntl) . . . . . . . . . . . .213 15-6 tim counter modulo registers (tmodh and tmodl) . . . . .214 15-7 tim channel status and control registers (tsc0 and tsc1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .215 15-8 chxmax latency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .218 15-9 tim channel 0 registers (tch0h and tch0l) . . . . . . . . . . .219 15-10 tim channel 1 registers (tch1h and tch1l) . . . . . . . . . . .219
advance information MC68HC908RF2 ? rev. 1 22 list of figures motorola list of figures figure title page 16-1 simplified integrated rf module block diagram . . . . . . . . . .222 16-2 main state machine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .226 16-3 signals, waveforms, and timing definitions . . . . . . . . . . . . .228 16-4 application schematic in ook modulation, 315-mhz and 434-mhz frequency bands . . . . . . . . . . . .229 16-5 application schematic in fsk modulation, 315-mhz and 434-mhz frequency bands . . . . . . . . . . . .230 16-6 complete application schematic in ook modulation, 434-mhz frequency band. . . . . . . . . . . . . . . . . . . . . . . . .232 17-1 rf spectrum at 434-mhz frequency band displayed with a 5-mhz span . . . . . . . . . . . . . . . . . 242 17-2 rf spectrum at 434-mhz frequency band displayed with a 50-mhz span . . . . . . . . . . . . . . . . . . . . .243 17-3 rf spectrum at 434-mhz frequency band displayed with a 1.5-ghz span. . . . . . . . . . . . . . . . . . . . . 243 17-4 output power measurement configurations. . . . . . . . . . . . . .244 17-5 ouput characteristic and matching network for 434-mhz frequency band . . . . . . . . . . . . . . . . . . . . . .245 17-6 output power at 434-mhz frequency band versus r ext value. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .245
MC68HC908RF2 ? rev. 1 advance information motorola list of tables 23 advance information ? MC68HC908RF2 list of tables table title page 1-1 uhf transmitter pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .31 2-1 vector locations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .41 4-1 charge pump clock frequency . . . . . . . . . . . . . . . . . . . . . . . .49 4-2 erase block sizes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 4-3 embedded flash routines. . . . . . . . . . . . . . . . . . . . . . . . . . .55 4-4 embedded flash routine global variables. . . . . . . . . . . . . .56 4-5 ctlbyte-erase block size . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 5-1 instruction set summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . .73 5-2 opcode map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .80 6-1 signal name conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . .84 8-1 correction sizes from dlf to dco . . . . . . . . . . . . . . . . . . . .115 8-2 clock monitor reference divider ratios. . . . . . . . . . . . . . . . . 120 8-3 quantization error in iclk . . . . . . . . . . . . . . . . . . . . . . . . . . .128 8-4 typical settling time examples . . . . . . . . . . . . . . . . . . . . . . .133 8-5 icg module register bit interaction summary. . . . . . . . . . . .140 10-1 monitor mode entry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .154 10-2 mode differences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .155 10-3 read (read memory) command . . . . . . . . . . . . . . . . . . . . .157 10-4 write (write memory) command. . . . . . . . . . . . . . . . . . . . .158 10-5 iread (indexed read) command . . . . . . . . . . . . . . . . . . . . .158 10-6 iwrite (indexed write) command . . . . . . . . . . . . . . . . . . . .159 10-7 readsp (read stack pointer) command . . . . . . . . . . . . . . .159 10-8 run (run user program) command . . . . . . . . . . . . . . . . . . .160
advance information MC68HC908RF2 ? rev. 1 24 list of tables motorola list of tables table title page 12-1 lowv bit indication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .171 13-1 port a pin functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .179 13-2 port b pin functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .182 15-1 pin name conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .199 15-2 prescaler selection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .212 15-3 mode, edge, and level selection . . . . . . . . . . . . . . . . . . . . . .217 16-1 frequency band selection and associated divider ratios. . . . . . . . . . . . . . . . . . . . . .223 16-2 dataclk frequency versus crystal oscillator frequency . . . . . . . . . . . . . . . . . 225 16-3 component description . . . . . . . . . . . . . . . . . . . . . . . . . . . . .230 16-4 recommended crystal characteristics (smd ceramic package) . . . . . . . . . . . . . . . . . . . . . . . . . .231 16-5 crystal pulling capacitor value versus carrier frequency total deviation . . . . . . . . . . . . .231 19-1 mc order numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .251
MC68HC908RF2 ? rev. 1 advance information motorola general description 25 advance information ? MC68HC908RF2 section 1. general description 1.1 contents 1.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .25 1.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .26 1.4 mcu block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 1.5 pin assignments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .29 1.5.1 power supply pins (v dd and v ss ) . . . . . . . . . . . . . . . . . . . .29 1.5.2 oscillator pins (osc1 and osc2) . . . . . . . . . . . . . . . . . . . .30 1.5.3 external reset (rst ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 1.5.4 external interrupt pin (irq1 ) . . . . . . . . . . . . . . . . . . . . . . . .30 1.5.5 port a input/output pins (pta7, pta6/kbd6 ? pta1/kbd1, and pta0) . . . . . . . .31 1.5.6 port b input/output pins (ptb3/tclk, ptb2/tch0, ptb1, and ptb0/mclk) . . . . . . . . . . . . . .31 1.5.7 uhf transmitter pins. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .31 1.2 introduction the MC68HC908RF2 mcu is a member of the low-cost, high-performance m68hc08 family of 8-bit microcontroller units (mcus). optimized for low-power operation and available in a small 32-pin low-profile quad flat pack (lqfp), this mcu is well suited for remote keyless entry (rke) transmitter designs. the m68hc08 family is based on the customer-specified integrated circuit (csic) design strategy. all mcus in the family use the enhanced m68hc08 central processor unit (cpu08) and are available with a variety of modules, memory sizes and types, and package types.
advance information MC68HC908RF2 ? rev. 1 26 general description motorola general description 1.3 features features of the MC68HC908RF2 mcu include:  high-performance m68hc08 architecture  fully upward-compatible object code with m6805, m146805, and m68hc05 families  maximum internal bus frequency of 4 mhz at 3.3 volts  maximum internal bus frequency of 2 mhz at 1.8 volts  internal oscillator requiring no external components: ? software selectable bus frequencies ? 25 percent accuracy with trim capability to 2 percent ? option to allow use of external clock source or external crystal/ceramic resonator  2 kbytes of on-chip flash memory  flash program memory security (1)  128 bytes of on-chip ram  16-bit, 2-channel timer interface module (tim)  12 general-purpose input/output (i/o) ports: ? six shared with keyboard wakeup function ? two shared with the timer module ? port a pins have 3-ma sink capabilities  low-voltage inhibit (lvi) module: ? 1.85-v detection forces mcu into reset ? 2.0-v detection sets indicator flag  6-bit keyboard interrupt with wakeup feature  external asynchronous interrupt pin with internal pullup (irq1 )  ultra high frequency (uhf) transmitter 1. no security feature is absolutely secure. however, motorola ? s strategy is to make reading or copying the flash difficult for unauthorized users.
general description mcu block diagram MC68HC908RF2 ? rev. 1 advance information motorola general description 27  system protection features: ? computer operating properly (cop) reset ? low-voltage detection with reset ? illegal opcode detection with reset ? illegal address detection with reset  32-pin plastic lqfp package  low-power design with stop and wait modes  master reset pin and power-on reset (por) ? 40 to 85 celsius operation features of the cpu08 include:  enhanced hc05 programming model  extensive loop control functions  16 addressing modes (eight more than the hc05)  16-bit index register and stack pointer  memory-to-memory data transfers  fast 8 8 multiply instruction  fast 16/8 divide instruction  binary-coded decimal (bcd) instructions  optimization for controller applications  third party c language support 1.4 mcu block diagram figure 1-1 shows the structure of the MC68HC908RF2 mcu.
advance information MC68HC908RF2 ? rev. 1 28 general description motorola general description figure 1-1. MC68HC908RF2 mcu block diagram system integration module computer operating properly module security module arithmetic/logic unit (alu) cpu registers m68hc08 cpu control and status registers ? 32 bytes user flash ? 2031 bytes user ram ? 128 bytes monitor rom ? 768 bytes user flash vector space ? 14 bytes keyboard/interrupt module power internal bus v dd v ss ptb ddrb * pin contains integrated pullup resistor ** high current sink pin ? pin contains software selectable pullup resistor power-on reset module low-voltage inhibit module ptb2/tch0 ptb3/tclk osc1 osc2 irq1 * 2-channel timer module pta ddra pta0** pta1/kbd1 ? ** pta2/kbd2 ? ** pta3/kbd3 ? ** pta4/kbd4 ? ** pta5/kbd5 ? ** pta7** pta6/kbd6 ? ** ptb1 ptb0/mclk rst * software selectable internal oscillator module v cc mode enable data band rfout gndrf rext xtal1 xtal0 dataclk cfsk uhf transmitter
general description pin assignments MC68HC908RF2 ? rev. 1 advance information motorola general description 29 1.5 pin assignments figure 1-2 shows the pin assignments. figure 1-2. lqfp pin assignments 1.5.1 power supply pins (v dd and v ss ) v dd and v ss are the power supply and ground pins. the mcu operates from a single power supply. fast signal transitions on mcu pins place high, short-duration current demands on the power supply. to prevent noise problems, take special care to provide power supply bypassing at the mcu as shown in figure 1-3 . place the bypass capacitors as close to the mcu power pins as possible. use high-frequency-response ceramic capacitors for c bypass . c bulk are optional bulk current bypass capacitors for use in applications that require the port pins to source high-current levels. osc2 v dd v ss osc1 ptb3/tclk dataclk data band pta7 rst irq1 xtal0 xtal1 gnd ptb2/tch0 ptb1 ptb0/mclk pta0 pta1/kbd1 rext cfsk v cc rfout gndrf v cc enable mode 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 24 23 22 21 20 19 18 17 32 31 30 29 28 27 26 25 1 pta4/kbd pta2/kbd pta3/kbd pta5/kbd pta6/kbd
advance information MC68HC908RF2 ? rev. 1 30 general description motorola general description figure 1-3. power supply bypassing 1.5.2 oscillator pins (osc1 and osc2) the osc1 and osc2 pins are the connections to an external clock source or crystal/ceramic resonator. 1.5.3 external reset (rst ) a logic 0 on the rst pin forces the mcu to a known startup state. rst is bidirectional, allowing a reset of the entire system. it is driven low when any internal reset source is asserted. the rst pin contains an internal pullup resistor. for additional information, see section 6. system integration module (sim) . 1.5.4 external interrupt pin (irq1 ) irq1 is an asynchronous external interrupt pin. the irq1 pin contains an internal pullup resistor. mcu v dd c bulk v ss v dd + note: component values shown represent typical applications. c bypass 0.1 f
general description pin assignments MC68HC908RF2 ? rev. 1 advance information motorola general description 31 1.5.5 port a input/output pins (pta7, pta6/kbd6 ? pta1/kbd1, and pta0) port a is an 8-bit special function port that shares its pins with the keyboard interrupt. six port a pins (pta6 ? pta1) can be programmed to serve as an external interrupt. once enabled, that pin will contain an internal pullup resistor. all port a pins are high-current sink pins. 1.5.6 port b input/output pins (ptb3/tclk, ptb2/tch0, ptb1, and ptb0/mclk) port b is a 4-bit, general-purpose, bidirectional i/o port, with some of its pins shared with the timer (tim) module. 1.5.7 uhf transmitter pins the MC68HC908RF2 ? rev. 1 uses dedicated pins for its uhf module. these pins are described in table 1-1 . table 1-1. uhf transmitter pins pin function description 6 gnd ground 7 xtal1 reference oscillator input 8 xtal0 reference oscillator output 9 rext output amplifier current setting resistor 10 cfsk fsk switch output 11 v cc power supply 12 rfout power amplifier output 13 gndrf power amplifier ground 14 v cc power supply 15 enable enable input 16 mode modulation type selection input 17 band frequency band selection 18 data data input 19 dataclk clock output to the microcontroller
advance information MC68HC908RF2 ? rev. 1 32 general description motorola general description
MC68HC908RF2 ? rev. 1 advance information motorola memory map 33 advance information ? MC68HC908RF2 section 2. memory map 2.1 contents 2.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .33 2.3 input/output section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .35 2.4 monitor rom . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .42 2.2 introduction the memory map, shown in figure 2-1 , includes:  2031 bytes of user flash memory  128 bytes of random-access memory (ram)  14 bytes of user-defined vectors in flash memory  768 bytes of monitor read-only memory (rom) these definitions apply to the memory map representation of reserved and unimplemented locations:  reserved ? accessing a reserved location can have unpredictable effects on mcu operation.  unimplemented ? accessing an unimplemented location causes an illegal address reset.
advance information MC68HC908RF2 ? rev. 1 34 memory map motorola memory map $0000 $003f i/o registers (28 bytes) $0040 $007f unimplemented (64 bytes) $0080 $00ff ram (128 bytes) $0100 $77ff unimplemented (30,464 bytes) $7800 $7fee flash memory (2031 bytes) $7fef optional factory determined icg trim value (1) $7ff0 $efff unimplemented (28,688 bytes) $f000 $f2ef monitor rom (752 bytes) $f2f0 $fdff unimplemented (2832 bytes) $fe00 sim break status register (sbsr) $fe01 sim reset status register (srsr) $fe02 sim break flag control register (sbfcr) $fe03 $fe06 reserved (4 bytes) $fe07 unimplemented (1 byte) $fe08 flash control register (flcr) $fe09 reserved (1 byte) $fe0a $fe0b unimplemented (2 bytes) $fe0c break address register high (brkh) $fe0d break address register low (brkl) 1. address $7fef is reserved for an optional factory-determined icg trim value. consult with a local motorola representative for more information and availability of this option. figure 2-1. memory map
memory map input/output section MC68HC908RF2 ? rev. 1 advance information motorola memory map 35 2.3 input/output section addresses $0000 ? $003f, shown in figure 2-2 , contain most of the control, status, and data registers. additional i/o registers have these addresses:  $fe00 ? sim break status register, sbsr  $fe01 ? sim reset status register, srsr  $fe02 ? sim break flag control register, bfcr  $fe08 ? flash control register, flcr  $fe0c ? break address register high, brkh  $fe0d ? break address register low, brkl  $fe0e ? break status and control register, bscr  $fe0f ? lvi status register, lvisr  $fff0 ? flash block protection register, flbpr  $ffff ? cop control register, copctl $fe0e break status and control register (bscr) $fe0f lvi status register (lvisr) $fe10 $feef unimplemented (222 bytes) $fef0 $feff monitor rom (16 bytes) $ff00 $ffef unimplemented (240 bytes) $fff0 flash block protect register (flbpr) $fff1 reserved (1 byte) $fff2 $ffff flash vectors (14 bytes) figure 2-1. memory map (continued)
advance information MC68HC908RF2 ? rev. 1 36 memory map motorola memory map addr. register name bit 7654321bit 0 $0000 port a data register (pta) see page 177. read: pta7 pta6 pta5 pta4 pta3 pta2 pta1 pta0 write: reset: unaffected by reset $0001 port b data register (ptb) see page 180. read: ptb3 ptb2 ptb1 ptb0 write: reset: unaffected by reset $0002 unimplemented $0003 unimplemented $0004 data direction register a (ddra) see page 178. read: ddra7 ddra6 ddra5 ddra4 ddra3 ddra2 ddra1 ddra0 write: reset:00000000 $0005 data direction register b (ddrb) see page 181. read: mclken 0 ddrb3 ddrb2 ddrb1 ddrb0 write: reset:00000000 $0006 unimplemented $0019 unimplemented $001a irq and keyboard status and control register (intkbscr) see page 193. read: irq1f 0 imaski modei keyf 0 imaskk modek write: r acki r ackk reset:00000000 $001b keyboard interrupt enable register (intkbier) see page 196. read: 0 kbie6 kbie5 kbie4 kbie3 kbie2 kbie1 0 write: reset:00000000 = unimplemented r = reserved u = unaffected x = indeterminate figure 2-2. control, status, and data registers (sheet 1 of 6)
memory map input/output section MC68HC908RF2 ? rev. 1 advance information motorola memory map 37 $001c unimplemented $001e unimplemented $001f configuration register (config) see page 148. read: extslow lvistop lvirst lvipwr coprs ssrec stop copd write: reset:00110000 $0020 timer status and control register (tsc) see page 213. read: tof toie tstop 00 ps2 p s1 ps0 write: 0 trst reset:00100000 $0021 timer counter register high (tcnth) see page 215. read: bit 15 14 13 12 11 10 9 bit 8 write: reset:00000000 $0022 timer counter register low (tcntl) see page 215. read: bit 7 6 54321bit 0 write: reset:00000000 $0023 timer counter modulo register high (tmodh) see page 216. read: bit 15 14 13 12 11 10 9 bit 8 write: reset:11111111 $0024 timer counter modulo register low (tmodl) s ee page 216. read: bit 7654321bit 0 write: reset:11111111 $0025 timer channel 0 status and control register (tsc0) see page 217. read: ch0f ch0ie ms0b ms0a els0b els0a tov0 ch0max write: 0 reset:00000000 addr. register name bit 7654321bit 0 = unimplemented r = reserved u = unaffected x = indeterminate figure 2-2. control, status, and data registers (sheet 2 of 6)
advance information MC68HC908RF2 ? rev. 1 38 memory map motorola memory map $0026 timer channel 0 register high (tch0h) see page 221. read: bit 15 14 13 12 11 10 9 bit 8 write: reset: indeterminate after reset $0027 timer channel 0 register low (tch0l) see page 221. read: bit 7654321bit 0 write: reset: indeterminate after reset $0028 timer channel 1 status and control register (tsc1) see page 217. read: ch1f ch1ie 0 ms1a els1b els1a tov1 ch1max write: 0 reset:00000000 $0029 timer channel 1 register high (tch1h) see page 221. read: bit 15 14 13 12 11 10 9 bit 8 write: reset: indeterminate after reset $002a timer channel 1 register low (tch1l) see page 221. read: bit 7654321bit 0 write: reset: indeterminate after reset $002b unimplemented $0035 unimplemented $0036 internal clock generator control register (icgcr) see page 141. read: cmie cmf cmon cs icgon icgs ecgon ecgs write: reset:00001000 $0037 internal clock generator multiplier register (icgmr) see page 143. read: r n6n5n4n3n2n1n0 write: reset:00010101 addr. register name bit 7654321bit 0 = unimplemented r = reserved u = unaffected x = indeterminate figure 2-2. control, status, and data registers (sheet 3 of 6)
memory map input/output section MC68HC908RF2 ? rev. 1 advance information motorola memory map 39 $0038 internal clock generator trim register (icgtr) see page 144. read: trim7 t rim6 trim5 t rim4 trim3 t rim2 trim1 t rim0 write: reset:10000000 $0039 icg dco divider control register (icgdvr) see page 145. read: rrrrddiv3ddiv2ddiv1ddiv0 write: reset:0 0 0 0uuuu $003a icg dco stage register (icgdsr) see page 146. read: dstg7 dstg6 dstg5 dstg4 dstg3 dstg2 dstg1 dstg0 write: reset: unaffected by reset $003b reserved rrrrrrrr $003c unimplemented $003f unimplemented $fe00 sim break status register (sbsr) s ee page 9 9 . read: rrrrrr sbsw r write: see note reset: 0 note: writing a logic 0 clears sbsw $fe01 sim reset status register (srsr) s ee page 10 0 . read: por pin cop ilop ilad 0 lvi 0 write: por:1xxxxxxx $fe02 sim break flag control register (sbfcr) s ee page 10 1 . read: bcferrrrrrr write: reset:00000000 $fe03 reserved rrrrrrrr addr. register name bit 7654321bit 0 = unimplemented r = reserved u = unaffected x = indeterminate figure 2-2. control, status, and data registers (sheet 4 of 6)
advance information MC68HC908RF2 ? rev. 1 40 memory map motorola memory map $fe04 reserved rrrrrrrr $fe05 unimplemented $fe07 unimplemented $fe08 flash 2ts control register (flcr) see page 47. read: 0 fdiv0 blk1 blk0 hven margin erase pgm write: reset:00000000 $fe09 reserved rrrrrrrr $fe0a unimplemented $fe0b unimplemented $fe0c break address register high (brkh) see page 108. read: bit 15 14 13 12 11 10 9 bit 8 write: reset:00000000 $fe0d break address register low (brkl) see page 108. read: bit 7654321bit 0 write: reset:00000000 $fe0e break status and control register (bscr) see page 107. read: brke brka 000000 write: reset:00000000 $fe0f lvi status register (lvisr) see page 172. read: lviout 0 lowv 00000 write: reset:00000000 addr. register name bit 7654321bit 0 = unimplemented r = reserved u = unaffected x = indeterminate figure 2-2. control, status, and data registers (sheet 5 of 6)
memory map input/output section MC68HC908RF2 ? rev. 1 advance information motorola memory map 41 table 2-1 is a list of vector locations. $fff0 flash 2ts block protect register (flbpr) ? s ee page 5 4 . read: rrrrbpr3bpr2bpr1bpr0 write: reset: unaffected by reset ? non-volatile flash register $ffff cop control register (copctl) see page 167. read: low byte of reset vector write: writing clears cop counter (any value) reset: unaffected by reset addr. register name bit 7654321bit 0 = unimplemented r = reserved u = unaffected x = indeterminate figure 2-2. control, status, and data registers (sheet 6 of 6) table 2-1. vector locations address vector low $fff2 icg vector (high) $fff3 icg vector (low) priority $fff4 tim overflow vector (high) $fff5 tim overflow vector (low) $fff6 tim channel 1 vector (high) $fff7 tim channel 1 vector (low) $fff8 tim channel 0 vector (high) $fff9 tim channel 0 vector (low) $fffa irq1/keyboard vector (high) $fffb irq1/keyboard vector (low) $fffc swi vector (high) $fffd swi vector (low) high $fffe reset vector (high) $ffff reset vector (low)
advance information MC68HC908RF2 ? rev. 1 42 memory map motorola memory map 2.4 monitor rom the 768 bytes at addresses $f000 ? f2ef and $fef0 ? $feff are utilized by the monitor rom. the address range $f000 ? f2ef is reserved for the monitor code functions, flash memory programming, and erase algorithms. the address range $fef0 ? $feff holds reserved rom addresses that contain the monitor code reset vectors.
MC68HC908RF2 ? rev. 1 advance information motorola random-access memory (ram) 43 advance information ? MC68HC908RF2 section 3. random-access memory (ram) 3.1 contents 3.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .43 3.3 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 3.2 introduction this section describes the 128 bytes of random-access memory (ram). 3.3 functional description addresses $0080 ? $00ff are ram locations. the location of the stack ram is programmable. note: for correct operation, the stack pointer must point only to ram locations. before processing an interrupt, the cpu uses five bytes of the stack to save the contents of the cpu registers. note: for m68hc05, m6805, and m146805 compatibility, the h register is not stacked. during a subroutine call, the cpu uses two bytes of the stack to store the return address. the stack pointer decrements during pushes and increments during pulls. note: be careful when using nested subroutines. the cpu could overwrite data in the ram during a subroutine or during the interrupt stacking operation.
advance information MC68HC908RF2 ? rev. 1 44 random-access memory (ram) motorola random-access memory (ram)
MC68HC908RF2 ? rev. 1 advance information motorola flash 2ts memory 45 advance information ? MC68HC908RF2 section 4. flash 2ts memory 4.1 contents 4.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .45 4.3 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 4.4 flash 2ts control register . . . . . . . . . . . . . . . . . . . . . . . . . .47 4.5 flash 2ts charge pump frequency control. . . . . . . . . . . . .49 4.6 flash 2ts erase operation . . . . . . . . . . . . . . . . . . . . . . . . . .49 4.7 flash 2ts program/margin read operation . . . . . . . . . . . . .50 4.8 flash 2ts block protection . . . . . . . . . . . . . . . . . . . . . . . . . .53 4.9 flash 2ts block protect register . . . . . . . . . . . . . . . . . . . . .54 4.10 embedded program/erase routines . . . . . . . . . . . . . . . . . . . .55 4.11 embedded function descriptions. . . . . . . . . . . . . . . . . . . . . . .56 4.11.1 rdvrrng routine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 4.11.2 prgrnge routine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 4.11.3 erarnge routine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 4.11.4 redprog routine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .59 4.11.5 example routine calls . . . . . . . . . . . . . . . . . . . . . . . . . . . . .60 4.12 low-power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .62 4.12.1 wait mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .62 4.12.2 stop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .63 4.2 introduction this section describes the operation of the embedded flash 2ts memory. this memory can be read, programmed, and erased from a single external supply. the program and erase operations are enabled through the use of an internal charge pump.
advance information MC68HC908RF2 ? rev. 1 46 flash 2ts memory motorola flash 2ts memory 4.3 functional description the flash 2ts memory is appropriately named to describe its 2-transistor source-select bit cell. the flash 2ts memory is an array of 2031 bytes with an additional 14 bytes of user vectors and one byte for block protection. an erased bit reads as a logic 0 and a programmed bit reads as a logic 1. the address ranges for the user memory, control register, and vectors are:  $7800 ? $7fee, user space  $7fef, reserved ? optional icg trim value, see 8.8.3 icg trim register  $fff0, block protect register  $fe08, flash 2ts control register  $fff2 ? $ffff, these locations are reserved for user-defined interrupt and reset vectors this list is the row architecture for the user space array: $7800 ? $7807 (row 0) $7808 ? $780f (row 1) $7810 ? $7817 (row 2) $7818 ? $781f (row 3) $7820 ? $7827 (row 4) -------------------------- $7fe8 ? $7fef (row 253) program and erase operations are facilitated through control bits in a memory mapped register. details for these operations appear later in this section. memory in the flash 2ts array is organized into pages within rows. for the 2-kbyte array on the MC68HC908RF2, the page size is one byte. there are eight pages (or eight bytes) per row. programming operations are performed on a page basis, one byte at a time. erase operations are performed on a block basis. the minimum
flash 2ts memory flash 2ts control register MC68HC908RF2 ? rev. 1 advance information motorola flash 2ts memory 47 block size is one row of eight bytes. refer to table 4-2 for additional block size options. note: sometimes a program disturb condition, in which case an erased bit on the row being programmed unintentionally becomes programmed, occurs. the embedded smart programming algorithm implements a margin read technique to avoid program disturb. the margin read step of the smart programming algorithm is used to ensure programmed bits are programmed to sufficient margin for data retention over the device ? s lifetime. in the application code, perform an erase operation after eight program operations (on the same row) to further avoid program disturb. for availability of programming tools and more information, contact a local motorola representative. note: a security feature prevents viewing of the flash 2ts contents. (1) 4.4 flash 2ts control register the flash 2ts control register (flcr) controls program, erase, and margin read operations. fdiv0 ? frequency divide control bit this read/write bit selects the factor by which the charge pump clock is divided from the system clock. see 4.5 flash 2ts charge pump frequency control . 1. no security feature is absolutely secure. however, motorola ? s strategy is to make reading or copying the flash 2ts difficult for unauthorized users. address: $fe08 bit 7654321bit 0 read: 0 fdiv0 blk1 blk0 hven margin erase pgm write: reset:00000000 = unimplemented figure 4-1. flash 2ts control register (flcr)
advance information MC68HC908RF2 ? rev. 1 48 flash 2ts memory motorola flash 2ts memory blk1 ? block erase control bit this read/write bit together with blk0 allows erasing of blocks of varying size. see 4.6 flash 2ts erase operation for a description of available block sizes. blk0 ? block erase control bit this read/write bit together with blk1 allows erasing of blocks of varying size. see 4.6 flash 2ts erase operation for a description of available block sizes. hven ? high-voltage enable bit this read/write bit enables the charge pump to drive high voltages for program and erase operations in the array. hven can be set only if either pgm = 1 or erase = 1 and the proper sequence for smart programming or erase is followed. 1 = high voltage enabled to array and charge pump on 0 = high voltage disabled to array and charge pump off margin ? margin read control bit this read/write bit configures the memory for margin read operation. margin cannot be set if the hven = 1. margin will automatically return to unset (0) if asserted when hven = 1. 1 = margin read operation selected 0 = margin read operation unselected erase ? erase control bit this read/write bit configures the memory for erase operation. erase is interlocked with the pgm bit such that both bits cannot be set at the same time. 1 = erase operation selected 0 = erase operation unselected pgm ? program control bit this read/write bit configures the memory for program operation. pgm is interlocked with the erase bit such that both bits cannot be set at the same time. 1 = program operation selected 0 = program operation unselected
flash 2ts memory flash 2ts charge pump frequency control MC68HC908RF2 ? rev. 1 advance information motorola flash 2ts memory 49 4.5 flash 2ts charge pump frequency control the internal charge pump, required for program, margin read, and erase operations, is designed to operate most efficiently with a 2-mhz clock. the charge pump clock is derived from the bus clock. table 4-1 shows how the fdiv bits are used to select a charge pump frequency based on the bus clock frequency. program, margin read, and erase operations cannot be performed if the bus clock frequency is below 2 mhz. note: the charge pump is optimized for 2-mhz operation. 4.6 flash 2ts erase operation use this step-by-step procedure to erase a block of flash 2ts memory. refer to 17.13 memory characteristics for a detailed description of the times used in this algorithm. 1. set the erase, blk0, blk1, and fdiv0 bits in the flash 2ts control register. refer to table 4-1 for fdiv settings and to table 4-2 for block sizes. 2. ensure target portion of array is unprotected by reading the block protect register at address $fff0. refer to 4.8 flash 2ts block protection and 4.9 flash 2ts block protect register for more information. 3. write to any flash 2ts address with any data within the block address range desired. 4. set the hven bit. 5. wait for a time, t erase . 6. clear the hven bit. table 4-1. charge pump clock frequency fdiv0 pump clock frequency 0 bus frequency 1 1 bus frequency 2
advance information MC68HC908RF2 ? rev. 1 50 flash 2ts memory motorola flash 2ts memory 7. wait for a time, t kill , for the high voltages to dissipate. 8. clear the erase bit. 9. after a time, t hvd , the memory can be accessed in read mode again. note: while these operations must be performed in the order shown, other unrelated operations may occur between the steps. table 4-2 shows the various block sizes which can be erased in one erase operation. in step 3 of the erase operation, the cared addresses are latched and used to determine the location of the block to be erased. for instance, with blk0 = blk1 = 0, writing to any flash 2ts address in the range $7800 to $78f0 will enable the erase of all flash memory. 4.7 flash 2ts program/margin read operation note: after a total of eight program operations have been applied to a row, the row must be erased before further programming to avoid program disturb. an erased byte will read $00. the flash 2ts memory is programmed on a page basis. a page consists of one byte. the smart programming algorithm ( figure 4-2 ) is recommended to program every page in the flash 2ts memory. table 4-2. erase block sizes blk1 blk0 block size, addresses cared 0 0 full array: 2 kbytes 0 1 one-half array: 1 kbyte 1 0 eight rows: 64 bytes 1 1 single row: 8 bytes
flash 2ts memory flash 2ts program/margin read operation MC68HC908RF2 ? rev. 1 advance information motorola flash 2ts memory 51 the embedded smart programming algorithm uses this step-by-step sequence to program the data into the flash memory. the algorithm optimizes the time required to program each page. refer to 4.10 embedded program/erase routines for information on utilizing embedded routines. 1. set the fdiv bits. these bits determine the charge pump frequency. 2. set pgm = 1. this configures the memory for program operation and enables the latching of address and data for programming. 3. read the flash 2ts block protect register (flbpr). 4. write data to the one byte being programmed. 5. set hven = 1. 6. wait for a time, t step . 7. set hven = 0. 8. wait for a time, t hvtv . 9. set margin = 1. 10. wait for a time, t vtp . 11. set pgm = 0. 12. wait for a time, t hvd . 13. read back data in margin read mode. this read operation is stretched by eight cycles. 14. clear the margin bit. if the margin read data is identical to write data, the program operation is complete; otherwise, jump to step 2. note: while these operations must be performed in the order shown, other unrelated operations may occur between the steps. the smart programming algorithm guarantees the minimum possible program time.
advance information MC68HC908RF2 ? rev. 1 52 flash 2ts memory motorola flash 2ts memory figure 4-2. smart programming algorithm flowchart program flash 2ts initialize attempt counter set pgm bit and fdiv bits wait t hvtv wait t vtp set hven bit clear pgm bit set margin bit wait t hvd increment attempt counter y n to 0 y n programming operation failed programming operation complete write data to selected page wait t step clear hven bit margin read page of data clear margin bit margin read data equal to write data? read flash block protect reg. page program/margin read procedure note: this page program algorithm assumes the page/s to be programmed are initially erased. note: this algorithm is mandatory for programming the flash 2ts. set interrupt mask: clear margin bit clear interrupt mask: sei instruction cli instruction attempt count equal to fls pulses ?
flash 2ts memory flash 2ts block protection MC68HC908RF2 ? rev. 1 advance information motorola flash 2ts memory 53 4.8 flash 2ts block protection note: in performing a program or erase operation, the flash 2ts block protect register must be read after setting the pgm or erase bit and before asserting the hven bit. due to the ability of the on-board charge pump to erase and program the flash 2ts memory in the target application, provision is made for protecting blocks of memory from unintentional erase or program operations due to system malfunction. this protection is implemented by a reserved location in the memory for block protect information. this block protect register must be read before setting hven = 1. when the block protect register is read, its contents are latched by the flash 2ts control logic. if the address range for an erase or program operation includes a protected block, the pgm or erase bit is cleared which prevents the hven bit in the flash 2ts control register from being set such that no high-voltage operation is allowed in the array. when the block protect register is erased (all 0s), the entire memory is accessible for program and erase. when bits within the register are programmed, they lock blocks of memory address ranges as shown in 4.9 flash 2ts block protect register . the block protect register itself can be erased or programmed only with an external voltage v hi present on the irq1 pin. the presence of v hi on the irq1 pin also allows entry into monitor mode out of reset. therefore, the ability to change the block protect register is voltage-level dependent and can occur in either user or monitor modes.
advance information MC68HC908RF2 ? rev. 1 54 flash 2ts memory motorola flash 2ts memory 4.9 flash 2ts block protect register the block protect register (flbpr) is implemented as a byte within the flash 2ts memory. each bit, when programmed, protects a range of addresses in the flash 2ts. bpr3 ? block protect register bit 3 this bit protects the memory contents in the address ranges $7a00 ? $7fef and $fff0 ? $ffff. 1 = address range protected from erase or program 0 = address range open to erase or program bpr2 ? block protect register bit 2 this bit protects the memory contents in the address ranges $7900 ? $7fef and $fff0 ? $ffff. 1 = address range protected from erase or program 0 = address range open to erase or program bpr1 ? block protect register bit 1 this bit protects the memory contents in the address ranges $7880 ? $7fef and $fff0 ? $ffff. 1 = address range protected from erase or program 0 = address range open to erase or program bpr0 ? block protect register bit 0 this bit protects the flash memory contents in the address ranges $7800 ? $7fef and $fff0 ? $ffff. 1 = address range protected from erase or program 0 = address range open to erase or program address: $fff0 bit 7654321bit 0 read: rrrrbpr3bpr2bpr1bpr0 write: reset: unaffected by reset r= reserved figure 4-3. flash 2ts block protect register (flbpr)
flash 2ts memory embedded program/erase routines MC68HC908RF2 ? rev. 1 advance information motorola flash 2ts memory 55 by programming the block protect bits, a portion of the memory will be locked so that no further erase or program operations may be performed. programming more than one bit at a time is redundant. if both bit 1 and bit 2 are set, for instance, the flash address ranges between $7880 ? $ffff are locked. if all bits are erased, then all of the memory is available for erase and program. the presence of a voltage v hi on the irq1 pin will bypass the block protection so that all of memory, including the block protect register, can be programmed or erased. 4.10 embedded program/erase routines the MC68HC908RF2 monitor rom contains numerous routines for programming and erasing the flash memory. these embedded routines are intended to assist the programmer with modifying the flash memory array. these routines will implement the smart programming algorithm as defined in figure 4-2 . the functions are listed in table 4-3 . the functions shown in table 4-3 accept data through the cpu registers and global variables in ram. table 4-4 shows the ram locations that are used for passing parameters. table 4-3. embedded flash routines function description call jsr to address (1) 1. romstrt is defined as the starting address of the monitor rom in the memory map. this is address $f000. read/verify a range rdvrrng romstrt + 0 program range of flash prgrnge romstrt + 3 erase range of flash erarnge romstrt + 6 redundant program flash redprog romstrt + 9
advance information MC68HC908RF2 ? rev. 1 56 flash 2ts memory motorola flash 2ts memory 4.11 embedded function descriptions this subsection describes the embedded functions. 4.11.1 rdvrrng routine name: rdvrrng purpose: read and/or verify a range of flash memory entry conditions: h:x contains the first address of the range laddr contains the last address of the range data contains the data to compare the read data against for read/verify to ram only (length is user determined) acc non-zero for read/verify to ram, 0 for output to pa0 exit conditions: c bit set if good compare for read/verify to ram only acc contains checksum data contains read flash data for read/verify to ram only table 4-4. embedded flash routine global variables variable location variable address (1) ctrlbyt ramstart + 8 cpuspd ramstart + 9 laddr ramstart + 10 bumps ramstart + 12 derase ramstart + 13 data ramstart + 15 1. ramstart is defined as the starting address of the ram in the memory map. this is address $0080.
flash 2ts memory embedded function descriptions MC68HC908RF2 ? rev. 1 advance information motorola flash 2ts memory 57 ready/verify ram option: this subroutine both compares data passed in the data array to the flash data and reads the data from flash into the data array. it also calculates the checksum of the data. output to pa0 option: this subroutine dumps the data from the range to pa0 in the same format as monitor data. it also calculates the checksum of the data. note: this serial dump does not circumvent security because the security vectors must still be passed to make flash readable in monitor mode. 4.11.2 prgrnge routine name: prgrnge purpose: programs a range of addresses in flash memory entry conditions: h:x contains the first address in the range laddr contains the last address in the range data contains the data to be programmed (length is user determined) cpuspd contains the bus frequency times 4 in mhz bumps contains the maximum allowable number of programming bumps to use exit conditions: c bit set if successful program; cleared otherwise i bit set, masking interrupts this routine programs a range of flash defined by h:x and laddr. the range can be from one byte to as much ram as can be allocated to data. the smart programming algorithm defined in 4.7 flash 2ts program/margin read operation is used.
advance information MC68HC908RF2 ? rev. 1 58 flash 2ts memory motorola flash 2ts memory 4.11.3 erarnge routine name: erarnge purpose: erase a range of addresses in flash memory entry conditions: h:x contains an address in the range to be erased; range size specified by control byte ctlbyte contains the erase block size in bits 5 and 6 (see table 4-5 ) derase contains the erase delay time in s/24 cpuspd cpu frequency times 4 in mhz exit conditions: i bit set, masking interrupts. this routine erases the block of flash defined by h:x and ctlbyte. the algorithm defined in 4.6 flash 2ts erase operation is used. preserves the contents of h:x (address passed) table 4-5. ctlbyte-erase block size bit 6 bit 5 block size 0 0 full array 0 1 one half array 1 0 eight rows: 64 pages 1 1 single row: 8 pages
flash 2ts memory embedded function descriptions MC68HC908RF2 ? rev. 1 advance information motorola flash 2ts memory 59 4.11.4 redprog routine name: redprog purpose: this routine will use a range of multiple rows in the flash array to emulate increased write/erase cycling capability of one row. entry conditions: h:x contains the address of the first row in the range. this address must be the first address of a row (multiple of eight bytes) laddr address of last row in the range; must be the first address of a row (multiple of eight bytes) data data to program in the row (bit 7 of data + 0 is used internally and will be overwritten). routine will always use eight bytes starting at data. bumps contains the maximum allowable number of programming bumps to use cpuspd contains the bus frequency times 4 in mhz derase contains the erase delay time in s/24 exit conditions: c bit set if successful program; cleared otherwise i bit set, masking interrupts this routine uses a range of the flash array containing multiple rows to emulate increased write/erase cycling capability for data storage. the routine will write data to each row of the flash array (in the range defined) upon subsequent calls. the number of rows is the difference between the value in h:x and laddr, divided by 8. a row is the minimum range that can be programmed with the redprog routine. all rows in the range will be programmed once before any are programmed again. this approach is taken to ensure that all rows reach the end of lifetime at approximately the same time.
advance information MC68HC908RF2 ? rev. 1 60 flash 2ts memory motorola flash 2ts memory a special bit will be maintained by the routine, called a cycling bit, in each row. this bit is used to ensure that the data is programmed to all the rows defined in the range. this is the high bit of the first byte in each row. this bit cannot be used to store user data. it will be modified by the redprog routine. this is at bit 7 of the byte at address data+0. to determine which row to program, the algorithm will step from the first to the last row in a range looking for the first row whose cycling bit is different from the first. if all rows contain the same cycling bit, then the first row will be used. the row whose cycling bit is different will be erased and the entire row will be programmed with the given data, including a toggled version of the cycling bit. 4.11.5 example routine calls this code is for illustrative purposes only and does not represent valid syntax for any particular assembler. ram equ $80 rdvrrng equ $f000 prgrnge equ $f003 eranrge equ $f006 redprog equ $f009 ;************************************************************* ram definitions for subroutines ;************************************************************** org ram+8 ctrlbyt rmb 1 cpuspd rmb 1 laddr rmb 2 bumps rmb 1 derase rmb 2 ;allocation of ?data? space is dependent on the device and ;application
flash 2ts memory embedded function descriptions MC68HC908RF2 ? rev. 1 advance information motorola flash 2ts memory 61 data rmb 8 ;************************************************************* ; calling example for read/verify a range (rdvrrng) ;************************************************************** lda #$ff ;target is ram ldhx #$7807 ;end after first row sthx laddr ldhx #$7800 ;start at first row jsr rdvrrng ;data will contain flash info ;*************************************************************; calling example for erase a range (erarnge) ;************************************************************** mov #$08,cpuspd ;load bus frequency in mhz * 4 mov #$60,ctrlbyt ;bits 5&6 hold the block size to erase ;00 full array ;20 one-half array ;40 eight rows ;60 singe row ;remember a row is 1 byte ;set erase time in us/24, number in ;decimal ldhx #100000/24 sthx derase ldhx #$7800 ;address in the range to erase jsr erarnge ;call through jump table ;************************************************************; ; calling example for program a range (prgrnge) ;************************************************************* mov # ? p ? ,data mov # ? r ? ,data+1 mov # ? o ? ,data+2 mov # ? g ? ,data+3 mov # ? t ? ,data+4 mov # ? e ? ,data+5 mov # ? s ? ,data+6 mov # ? t ? ,data+7 mov #$08,cpuspd ;load bus frequency in mhz * 4 mov #$0a,bumps ;load max number of programming steps ;before a failure is returned ldhx #$7807 ;load the last address to program sthx laddr ;into laddr ldhx #$7800 ;load the first address to program ;into h:x ;this range may cross page boundaries ;and may be any length, so long as the ;data to program is loaded in ram ;beginning at data. jsr prgrnge ;call through jump table.
advance information MC68HC908RF2 ? rev. 1 62 flash 2ts memory motorola flash 2ts memory ;************************************************************** ; calling example for redundant program a row (redprog) ;************************************************************** mov #$56,data mov # ? p ? ,data+1 mov # ? r ? ,data+2 mov # ? o ? ,data+3 mov # ? g ? ,data+4 mov # ? r ? ,data+5 mov # ? e ? ,data+6 mov # ? d ? ,data+7 mov #$08,cpuspd ;load bus frequency in mhz * 4 mov #$0a,bumps ;load max number of programming steps ;before a failure is returned ;set erase time in us/24 ldhx #100000/24 sthx derase ldhx #$7808 ;load the last address of the multi-row ;range; (in this case, 2 rows) sthx laddr ;into laddr ldhx #$7800 ;load the first address of the ;multi-row range into h:x jsr redprog ;call through jump table. 4.12 low-power modes the wait and stop instructions put the mcu in low power- consumption standby modes. 4.12.1 wait mode putting the mcu into wait mode while the flash 2ts is in read mode does not affect the operation of the flash 2ts memory directly, but there will be no memory activity since the cpu is inactive. the wait instruction should not be executed while performing a program or erase operation on the flash 2ts. when the mcu is put into wait mode, the charge pump for the flash 2ts is disabled so that either a program or erase operation will not continue. if the memory is in either program mode (pgm = 1, hven = 1) or erase mode (erase = 1, hven = 1), then it will remain in that mode during wait. exit from wait mode must now be done with a reset rather than an interrupt because if
flash 2ts memory low-power modes MC68HC908RF2 ? rev. 1 advance information motorola flash 2ts memory 63 exiting wait with an interrupt, the memory will not be in read mode and the interrupt vector cannot be read from the memory. 4.12.2 stop mode when the mcu is put into stop mode, if the flash 2ts is in read mode, it will be put into low-power standby. the stop instruction should not be executed while performing a program or erase operation on the flash 2ts. when the mcu is put into stop mode, the charge pump for the flash 2ts is disabled so that either a program or erase operation will not continue. if the memory is in either program mode (pgm = 1, hven = 1) or erase mode (erase = 1, hven = 1), then it will remain in that mode during stop. exit from stop mode now must be done with a reset rather than an interrupt because if exiting stop with an interrupt, the memory will not be in read mode and the interrupt vector cannot be read from the memory.
advance information MC68HC908RF2 ? rev. 1 64 flash 2ts memory motorola flash 2ts memory
MC68HC908RF2 ? rev. 1 advance information motorola central processor unit (cpu) 65 advance information ? MC68HC908RF2 section 5. central processor unit (cpu) 5.1 contents 5.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .66 5.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .66 5.4 cpu registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 5.4.1 accumulator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .67 5.4.2 index register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 5.4.3 stack pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 5.4.4 program counter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .69 5.4.5 condition code register . . . . . . . . . . . . . . . . . . . . . . . . . . .69 5.5 arithmetic/logic unit (alu) . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 5.6 low-power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .71 5.6.1 wait mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .72 5.6.2 stop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .72 5.7 cpu during break interrupts . . . . . . . . . . . . . . . . . . . . . . . . . .72 5.8 instruction set summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . .72 5.9 opcode map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .79
advance information MC68HC908RF2 ? rev. 1 66 central processor unit (cpu) motorola central processor unit (cpu) 5.2 introduction the m68hc08 cpu is an enhanced and fully object-code-compatible version of the m68hc05 cpu. the cpu08 reference manual , motorola document order number cpu08rm/ad, contains a description of the cpu instruction set, addressing modes, and architecture. 5.3 features features of the cpu include:  object code fully upward-compatible with m68hc05 family  16-bit stack pointer with stack manipulation instructions  16-bit index register with x-register manipulation instructions  4-mhz cpu internal bus frequency  64-kbyte program/data memory space  16 addressing modes  memory-to-memory data moves without using accumulator  fast 8-bit by 8-bit multiply and 16-bit by 8-bit divide instructions  enhanced binary-coded decimal (bcd) data handling  modular architecture with expandable internal bus definition for extension of addressing range beyond 64 kbytes  low-power stop and wait modes 5.4 cpu registers figure 5-1 shows the five cpu registers. cpu registers are not part of the memory map.
central processor unit (cpu) cpu registers MC68HC908RF2 ? rev. 1 advance information motorola central processor unit (cpu) 67 figure 5-1. cpu registers 5.4.1 accumulator the accumulator is a general-purpose 8-bit register. the cpu uses the accumulator to hold operands and the results of arithmetic/logic operations. 5.4.2 index register the 16-bit index register allows indexed addressing of a 64-kbyte memory space. h is the upper byte of the index register, and x is the lower byte. h:x is the concatenated 16-bit index register. in the indexed addressing modes, the cpu uses the contents of the index register to determine the conditional address of the operand. accumulator (a) index register (h:x) stack pointer (sp) program counter (pc) condition code register (ccr) carry/borrow flag zero flag negative flag interrupt mask half-carry flag two ? s complement overflow flag v11hinzc h x 0 0 0 0 7 15 15 15 70 bit 7654321bit 0 read: write: reset: unaffected by reset figure 5-2. accumulator (a)
advance information MC68HC908RF2 ? rev. 1 68 central processor unit (cpu) motorola central processor unit (cpu) the index register can serve also as a temporary data storage location. 5.4.3 stack pointer the stack pointer is a 16-bit register that contains the address of the next location on the stack. during a reset, the stack pointer is preset to $00ff. the reset stack pointer (rsp) instruction sets the least significant byte (lsb) to $ff and does not affect the most significant byte (msb). the stack pointer decrements as data is pushed onto the stack and increments as data is pulled from the stack. in the stack pointer 8-bit offset and 16-bit offset addressing modes, the stack pointer can function as an index register to access data on the stack. the cpu uses the contents of the stack pointer to determine the conditional address of the operand. note: for correct operation, the stack pointer must point only to ram locations. bit 151413121110987654321 bit 0 read: write: reset:00000000 xxxxxxxx x = indeterminate figure 5-3. index register (h:x) bit 151413121110987654321 bit 0 read: write: reset:0000000011111111 figure 5-4. stack pointer (sp)
central processor unit (cpu) cpu registers MC68HC908RF2 ? rev. 1 advance information motorola central processor unit (cpu) 69 5.4.4 program counter the program counter is a 16-bit register that contains the address of the next instruction or operand to be fetched. normally, the program counter automatically increments to the next sequential memory location every time an instruction or operand is fetched. jump, branch, and interrupt operations load the program counter with an address other than that of the next sequential location. during reset, the program counter is loaded with the reset vector address located at $fffe and $ffff. the vector address is the address of the first instruction to be executed after exiting the reset state. 5.4.5 condition code register the 8-bit condition code register (ccr) contains the interrupt mask and five flags that indicate the results of the instruction just executed. bits 6 and 5 are set permanently to logic 1. the following paragraphs describe the functions of the condition code register. bit 151413121110987654321 bit 0 read: write: reset: loaded with vector from $fffe and $ffff figure 5-5. program counter (pc) bit 7654321bit 0 read: v11h i nzc write: reset:x11x1xxx x = indeterminate figure 5-6. condition code register (ccr)
advance information MC68HC908RF2 ? rev. 1 70 central processor unit (cpu) motorola central processor unit (cpu) v ? overflow flag the cpu sets the overflow flag when a two's complement overflow occurs. the signed branch instructions bgt, bge, ble, and blt use the overflow flag. 1 = overflow 0 = no overflow h ? half-carry flag the cpu sets the half-carry flag when a carry occurs between accumulator bits 3 and 4 during an add-without-carry (add) or add-with-carry (adc) operation. the half-carry flag is required for binary-coded decimal (bcd) arithmetic operations. the daa instruction uses the states of the h and c flags to determine the appropriate correction factor. 1 = carry between bits 3 and 4 0 = no carry between bits 3 and 4 i ? interrupt mask bit when the interrupt mask is set, all maskable cpu interrupts are disabled. cpu interrupts are enabled when the interrupt mask is cleared. when a cpu interrupt occurs, the interrupt mask is set automatically after the cpu registers are saved on the stack, but before the interrupt vector is fetched. 1 = interrupts disabled 0 = interrupts enabled note: to maintain m6805 compatibility, the upper byte of the index register (h) is not stacked automatically. if the interrupt service routine modifies h, then the user must stack and unstack h using the pshh and pulh instructions. after the i bit is cleared, the highest-priority interrupt request is serviced first. a return-from-interrupt (rti) instruction pulls the cpu registers from the stack and restores the interrupt mask from the stack. after any reset, the interrupt mask is set and can be cleared only by the clear interrupt mask software instruction (cli).
central processor unit (cpu) arithmetic/logic unit (alu) MC68HC908RF2 ? rev. 1 advance information motorola central processor unit (cpu) 71 n ? negative flag the cpu sets the negative flag when an arithmetic operation, logic operation, or data manipulation produces a negative result, setting bit 7 of the result. 1 = negative result 0 = non-negative result z ? zero flag the cpu sets the zero flag when an arithmetic operation, logic operation, or data manipulation produce a result of $00. 1 = zero result 0 = non-zero result c ? carry/borrow flag the cpu sets the carry/borrow flag when an addition operation produces a carry out of bit 7 of the accumulator or when a subtraction operation requires a borrow. some instructions ? such as bit test and branch, shift, and rotate ? also clear or set the carry/borrow flag. 1 = carry out of bit 7 0 = no carry out of bit 7 5.5 arithmetic/logic unit (alu) the alu performs the arithmetic and logic operations defined by the instruction set. refer to the cpu08 reference manual , motorola document order number cpu08rm/ad, for a description of the instructions and addressing modes and more detail about the architecture of the cpu. 5.6 low-power modes the wait and stop instructions put the mcu in low power-consumption standby modes.
advance information MC68HC908RF2 ? rev. 1 72 central processor unit (cpu) motorola central processor unit (cpu) 5.6.1 wait mode the wait instruction:  clears the interrupt mask (i bit) in the condition code register, enabling interrupts. after exit from wait mode by interrupt, the i bit remains clear. after exit by reset, the i bit is set.  disables the cpu clock 5.6.2 stop mode the stop instruction:  clears the interrupt mask (i bit) in the condition code register, enabling external interrupts. after exit from stop mode by external interrupt, the i bit remains clear. after exit by reset, the i bit is set.  disables the cpu clock after exiting stop mode, the cpu clock begins running after the oscillator stabilization delay. 5.7 cpu during break interrupts if the break module is enabled, a break interrupt causes the cpu to execute the software interrupt instruction (swi) at the completion of the current cpu instruction. (see section 7. break module (brk) .) the program counter vectors to $fffc ? $fffd ($fefc ? $fefd in monitor mode). a return-from-interrupt instruction (rti) in the break routine ends the break interrupt and returns the mcu to normal operation if the break interrupt has been deasserted. 5.8 instruction set summary table 5-1 provides a summary of the m68hc08 instruction set.
central processor unit (cpu) instruction set summary MC68HC908RF2 ? rev. 1 advance information motorola central processor unit (cpu) 73 table 5-1. instruction set summary (sheet 1 of 7) source form operation description effect on ccr address mode opcode operand cycles vh i nzc adc # opr adc opr adc opr adc opr ,x adc opr ,x adc ,x adc opr ,sp adc opr ,sp add with carry a (a) + (m) + (c)  ?  imm dir ext ix2 ix1 ix sp1 sp2 a9 b9 c9 d9 e9 f9 9ee9 9ed9 ii dd hh ll ee ff ff ff ee ff 2 3 4 4 3 2 4 5 add # opr add opr add opr add opr ,x add opr ,x add ,x add opr ,sp add opr ,sp add without carry a (a) + (m)  ?  imm dir ext ix2 ix1 ix sp1 sp2 ab bb cb db eb fb 9eeb 9edb ii dd hh ll ee ff ff ff ee ff 2 3 4 4 3 2 4 5 ais # opr add immediate value (signed) to sp sp (sp) + (16 ? m) ?????? imm a7 ii 2 aix # opr add immediate value (signed) to h:x h:x (h:x) + (16 ? m) ?????? imm af ii 2 and # opr and opr and opr and opr ,x and opr ,x and ,x and opr ,sp and opr ,sp logical and a (a) & (m) 0 ??  ? imm dir ext ix2 ix1 ix sp1 sp2 a4 b4 c4 d4 e4 f4 9ee4 9ed4 ii dd hh ll ee ff ff ff ee ff 2 3 4 4 3 2 4 5 asl opr asla aslx asl opr ,x asl ,x asl opr ,sp arithmetic shift left (same as lsl)  ??  dir inh inh ix1 ix sp1 38 48 58 68 78 9e68 dd ff ff 4 1 1 4 3 5 asr opr asra asrx asr opr ,x asr opr ,x asr opr ,sp arithmetic shift right  ??  dir inh inh ix1 ix sp1 37 47 57 67 77 9e67 dd ff ff 4 1 1 4 3 5 bcc rel branch if carry bit clear pc (pc) + 2 + rel ? (c) = 0 ?????? rel 24 rr 3 bclr n , opr clear bit n in m mn 0 ?????? dir (b0) dir (b1) dir (b2) dir (b3) dir (b4) dir (b5) dir (b6) dir (b7) 11 13 15 17 19 1b 1d 1f dd dd dd dd dd dd dd dd 4 4 4 4 4 4 4 4 bcs rel branch if carry bit set (same as blo) pc (pc) + 2 + rel ? (c) = 1 ?????? rel 25 rr 3 beq rel branch if equal pc (pc) + 2 + rel ? (z) = 1 ?????? rel 27 rr 3 bge opr branch if greater than or equal to (signed operands) pc (pc) + 2 + rel ? (n v ) = 0 ?????? rel 90 rr 3 bgt opr branch if greater than (signed operands) pc (pc) + 2 + rel ? (z) | (n v ) = 0 ?????? rel 92 rr 3 c b0 b7 0 b0 b7 c
advance information MC68HC908RF2 ? rev. 1 74 central processor unit (cpu) motorola central processor unit (cpu) bhcc rel branch if half carry bit clear pc (pc) + 2 + rel ? (h) = 0 ?????? rel 28 rr 3 bhcs rel branch if half carry bit set pc (pc) + 2 + rel ? (h) = 1 ?????? rel 29 rr 3 bhi rel branch if higher pc (pc) + 2 + rel ? (c) | (z) = 0 ?????? rel 22 rr 3 bhs rel branch if higher or same (same as bcc) pc (pc) + 2 + rel ? (c) = 0 ?????? rel 24 rr 3 bih rel branch if irq pin high pc (pc) + 2 + rel ? irq = 1 ?????? rel 2f rr 3 bil rel branch if irq pin low pc (pc) + 2 + rel ? irq = 0 ?????? rel 2e rr 3 bit # opr bit opr bit opr bit opr ,x bit opr ,x bit ,x bit opr ,sp bit opr ,sp bit test (a) & (m) 0 ??  ? imm dir ext ix2 ix1 ix sp1 sp2 a5 b5 c5 d5 e5 f5 9ee5 9ed5 ii dd hh ll ee ff ff ff ee ff 2 3 4 4 3 2 4 5 ble opr branch if less than or equal to (signed operands) pc (pc) + 2 + rel ? (z) | (n v ) = 1 ?????? rel 93 rr 3 blo rel branch if lower (same as bcs) pc (pc) + 2 + rel ? (c) = 1 ?????? rel 25 rr 3 bls rel branch if lower or same pc (pc) + 2 + rel ? (c) | (z) = 1 ?????? rel 23 rr 3 blt opr branch if less than (signed operands) pc (pc) + 2 + rel ? (n v ) = 1 ?????? rel 91 rr 3 bmc rel branch if interrupt mask clear pc (pc) + 2 + rel ? (i) = 0 ?????? rel 2c rr 3 bmi rel branch if minus pc (pc) + 2 + rel ? (n) = 1 ?????? rel 2b rr 3 bms rel branch if interrupt mask set pc (pc) + 2 + rel ? (i) = 1 ?????? rel 2d rr 3 bne rel branch if not equal pc (pc) + 2 + rel ? (z) = 0 ?????? rel 26 rr 3 bpl rel branch if plus pc (pc) + 2 + rel ? (n) = 0 ?????? rel 2a rr 3 bra rel branch always pc (pc) + 2 + rel ?????? rel 20 rr 3 brclr n , opr , rel branch if bit n in m clear pc (pc) + 3 + rel ? (mn) = 0 ?????  dir (b0) dir (b1) dir (b2) dir (b3) dir (b4) dir (b5) dir (b6) dir (b7) 01 03 05 07 09 0b 0d 0f dd rr dd rr dd rr dd rr dd rr dd rr dd rr dd rr 5 5 5 5 5 5 5 5 brn rel branch never pc (pc) + 2 ?????? rel 21 rr 3 brset n , opr , rel branch if bit n in m set pc (pc) + 3 + rel ? (mn) = 1 ?????  dir (b0) dir (b1) dir (b2) dir (b3) dir (b4) dir (b5) dir (b6) dir (b7) 00 02 04 06 08 0a 0c 0e dd rr dd rr dd rr dd rr dd rr dd rr dd rr dd rr 5 5 5 5 5 5 5 5 table 5-1. instruction set summary (sheet 2 of 7) source form operation description effect on ccr address mode opcode operand cycles vh i nzc
central processor unit (cpu) instruction set summary MC68HC908RF2 ? rev. 1 advance information motorola central processor unit (cpu) 75 bset n , opr set bit n in m mn 1 ?????? dir (b0) dir (b1) dir (b2) dir (b3) dir (b4) dir (b5) dir (b6) dir (b7) 10 12 14 16 18 1a 1c 1e dd dd dd dd dd dd dd dd 4 4 4 4 4 4 4 4 bsr rel branch to subroutine pc (pc) + 2; push (pcl) sp (sp) ? 1; push (pch) sp (sp) ? 1 pc (pc) + rel ?????? rel ad rr 4 cbeq opr,rel cbeqa # opr,rel cbeqx # opr,rel cbeq opr, x+ ,rel cbeq x+ ,rel cbeq opr, sp ,rel compare and branch if equal pc (pc) + 3 + rel ? (a) ? (m) = $00 pc (pc) + 3 + rel ? (a) ? (m) = $00 pc (pc) + 3 + rel ? (x) ? (m) = $00 pc (pc) + 3 + rel ? (a) ? (m) = $00 pc (pc) + 2 + rel ? (a) ? (m) = $00 pc (pc) + 4 + rel ? (a) ? (m) = $00 ?????? dir imm imm ix1+ ix+ sp1 31 41 51 61 71 9e61 dd rr ii rr ii rr ff rr rr ff rr 5 4 4 5 4 6 clc clear carry bit c 0 ????? 0inh 98 1 cli clear interrupt mask i 0 ?? 0 ??? inh 9a 2 clr opr clra clrx clrh clr opr ,x clr ,x clr opr ,sp clear m $00 a $00 x $00 h $00 m $00 m $00 m $00 0 ?? 01 ? dir inh inh inh ix1 ix sp1 3f 4f 5f 8c 6f 7f 9e6f dd ff ff 3 1 1 1 3 2 4 cmp # opr cmp opr cmp opr cmp opr ,x cmp opr ,x cmp ,x cmp opr ,sp cmp opr ,sp compare a with m (a) ? (m)  ??  imm dir ext ix2 ix1 ix sp1 sp2 a1 b1 c1 d1 e1 f1 9ee1 9ed1 ii dd hh ll ee ff ff ff ee ff 2 3 4 4 3 2 4 5 com opr coma comx com opr ,x com ,x com opr ,sp complement (one ? s complement) m (m ) = $ff ? (m) a (a ) = $ff ? (m) x (x ) = $ff ? (m) m (m ) = $ff ? (m) m (m ) = $ff ? (m) m (m ) = $ff ? (m) 0 ??  1 dir inh inh ix1 ix sp1 33 43 53 63 73 9e63 dd ff ff 4 1 1 4 3 5 cphx # opr cphx opr compare h:x with m (h:x) ? (m:m + 1)  ??  imm dir 65 75 ii ii+1 dd 3 4 cpx # opr cpx opr cpx opr cpx ,x cpx opr ,x cpx opr ,x cpx opr ,sp cpx opr ,sp compare x with m (x) ? (m)  ??  imm dir ext ix2 ix1 ix sp1 sp2 a3 b3 c3 d3 e3 f3 9ee3 9ed3 ii dd hh ll ee ff ff ff ee ff 2 3 4 4 3 2 4 5 daa decimal adjust a (a) 10 u ??  inh 72 2 table 5-1. instruction set summary (sheet 3 of 7) source form operation description effect on ccr address mode opcode operand cycles vh i nzc
advance information MC68HC908RF2 ? rev. 1 76 central processor unit (cpu) motorola central processor unit (cpu) dbnz opr,rel dbnza rel dbnzx rel dbnz opr, x ,rel dbnz x ,rel dbnz opr, sp ,rel decrement and branch if not zero a (a) ? 1 or m (m) ? 1 or x (x) ? 1 pc (pc) + 3 + rel ? (result) 0 pc (pc) + 2 + rel ? (result) 0 pc (pc) + 2 + rel ? (result) 0 pc (pc) + 3 + rel ? (result) 0 pc (pc) + 2 + rel ? (result) 0 pc (pc) + 4 + rel ? (result) 0 ?????? dir inh inh ix1 ix sp1 3b 4b 5b 6b 7b 9e6b dd rr rr rr ff rr rr ff rr 5 3 3 5 4 6 dec opr deca decx dec opr ,x dec ,x dec opr ,sp decrement m (m) ? 1 a (a) ? 1 x (x) ? 1 m (m) ? 1 m (m) ? 1 m (m) ? 1  ??  ? dir inh inh ix1 ix sp1 3a 4a 5a 6a 7a 9e6a dd ff ff 4 1 1 4 3 5 div divide a (h:a)/(x) h remainder ????  inh 52 7 eor # opr eor opr eor opr eor opr ,x eor opr ,x eor ,x eor opr ,sp eor opr ,sp exclusive or m with a a (a m) 0 ??  ? imm dir ext ix2 ix1 ix sp1 sp2 a8 b8 c8 d8 e8 f8 9ee8 9ed8 ii dd hh ll ee ff ff ff ee ff 2 3 4 4 3 2 4 5 inc opr inca incx inc opr ,x inc ,x inc opr ,sp increment m (m) + 1 a (a) + 1 x (x) + 1 m (m) + 1 m (m) + 1 m (m) + 1  ??  ? dir inh inh ix1 ix sp1 3c 4c 5c 6c 7c 9e6c dd ff ff 4 1 1 4 3 5 jmp opr jmp opr jmp opr ,x jmp opr ,x jmp ,x jump pc jump address ?????? dir ext ix2 ix1 ix bc cc dc ec fc dd hh ll ee ff ff 2 3 4 3 2 jsr opr jsr opr jsr opr ,x jsr opr ,x jsr ,x jump to subroutine pc (pc) + n ( n = 1, 2, or 3) push (pcl); sp (sp) ? 1 push (pch); sp (sp) ? 1 pc unconditional address ?????? dir ext ix2 ix1 ix bd cd dd ed fd dd hh ll ee ff ff 4 5 6 5 4 lda # opr lda opr lda opr lda opr ,x lda opr ,x lda ,x lda opr ,sp lda opr ,sp load a from m a (m) 0 ??  ? imm dir ext ix2 ix1 ix sp1 sp2 a6 b6 c6 d6 e6 f6 9ee6 9ed6 ii dd hh ll ee ff ff ff ee ff 2 3 4 4 3 2 4 5 ldhx # opr ldhx opr load h:x from m h:x ( m:m + 1 ) 0 ??  ? imm dir 45 55 ii jj dd 3 4 ldx # opr ldx opr ldx opr ldx opr ,x ldx opr ,x ldx ,x ldx opr ,sp ldx opr ,sp load x from m x (m) 0 ??  ? imm dir ext ix2 ix1 ix sp1 sp2 ae be ce de ee fe 9eee 9ede ii dd hh ll ee ff ff ff ee ff 2 3 4 4 3 2 4 5 table 5-1. instruction set summary (sheet 4 of 7) source form operation description effect on ccr address mode opcode operand cycles vh i nzc
central processor unit (cpu) instruction set summary MC68HC908RF2 ? rev. 1 advance information motorola central processor unit (cpu) 77 lsl opr lsla lslx lsl opr ,x lsl ,x lsl opr ,sp logical shift left (same as asl)  ??  dir inh inh ix1 ix sp1 38 48 58 68 78 9e68 dd ff ff 4 1 1 4 3 5 lsr opr lsra lsr x lsr opr ,x lsr ,x lsr opr ,sp logical shift right  ?? 0  dir inh inh ix1 ix sp1 34 44 54 64 74 9e64 dd ff ff 4 1 1 4 3 5 mov opr,opr mov opr, x+ mov # opr,opr mov x+ ,opr move (m) destination (m) source h:x (h:x) + 1 (ix+d, dix+) 0 ??  ? dd dix+ imd ix+d 4e 5e 6e 7e dd dd dd ii dd dd 5 4 4 4 mul unsigned multiply x:a (x) (a) ? 0 ??? 0inh 42 5 neg opr nega negx neg opr ,x neg ,x neg opr ,sp negate (two ? s complement) m ? (m) = $00 ? (m) a ? (a) = $00 ? (a) x ? (x) = $00 ? (x) m ? (m) = $00 ? (m) m ? (m) = $00 ? (m)  ??  dir inh inh ix1 ix sp1 30 40 50 60 70 9e60 dd ff ff 4 1 1 4 3 5 nop no operation none ?????? inh 9d 1 nsa nibble swap a a (a[3:0]:a[7:4]) ?????? inh 62 3 ora # opr ora opr ora opr ora opr ,x ora opr ,x ora ,x ora opr ,sp ora opr ,sp inclusive or a and m a (a) | (m) 0 ??  ? imm dir ext ix2 ix1 ix sp1 sp2 aa ba ca da ea fa 9eea 9eda ii dd hh ll ee ff ff ff ee ff 2 3 4 4 3 2 4 5 psha push a onto stack push (a); sp (sp ) ? 1 ?????? inh 87 2 pshh push h onto stack push (h) ; sp (sp ) ? 1 ?????? inh 8b 2 pshx push x onto stack push (x) ; sp (sp ) ? 1 ?????? inh 89 2 pula pull a from stack sp (sp + 1); pull ( a ) ?????? inh 86 2 pulh pull h from stack sp (sp + 1); pull ( h ) ?????? inh 8a 2 pulx pull x from stack sp (sp + 1); pull ( x ) ?????? inh 88 2 rol opr rola rolx rol opr ,x rol ,x rol opr ,sp rotate left through carry  ??  dir inh inh ix1 ix sp1 39 49 59 69 79 9e69 dd ff ff 4 1 1 4 3 5 ror opr rora rorx ror opr ,x ror ,x ror opr ,sp rotate right through carry  ??  dir inh inh ix1 ix sp1 36 46 56 66 76 9e66 dd ff ff 4 1 1 4 3 5 table 5-1. instruction set summary (sheet 5 of 7) source form operation description effect on ccr address mode opcode operand cycles vh i nzc c b0 b7 0 b0 b7 c 0 c b0 b7 b0 b7 c
advance information MC68HC908RF2 ? rev. 1 78 central processor unit (cpu) motorola central processor unit (cpu) rsp reset stack pointer sp $ff ?????? inh 9c 1 rti return from interrupt sp (sp) + 1; pull (ccr) sp (sp) + 1; pull (a) sp (sp) + 1; pull (x) sp (sp) + 1; pull (pch) sp (sp) + 1; pull (pcl)  inh 80 7 rts return from subroutine sp sp + 1 ; pull ( pch) sp sp + 1; pull (pcl) ?????? inh 81 4 sbc # opr sbc opr sbc opr sbc opr ,x sbc opr ,x sbc ,x sbc opr ,sp sbc opr ,sp subtract with carry a (a) ? (m) ? (c)  ??  imm dir ext ix2 ix1 ix sp1 sp2 a2 b2 c2 d2 e2 f2 9ee2 9ed2 ii dd hh ll ee ff ff ff ee ff 2 3 4 4 3 2 4 5 sec set carry bit c 1 ????? 1inh 99 1 sei set interrupt mask i 1 ?? 1 ??? inh 9b 2 sta opr sta opr sta opr ,x sta opr ,x sta ,x sta opr ,sp sta opr ,sp store a in m m (a) 0 ??  ? dir ext ix2 ix1 ix sp1 sp2 b7 c7 d7 e7 f7 9ee7 9ed7 dd hh ll ee ff ff ff ee ff 3 4 4 3 2 4 5 sthx opr store h:x in m (m:m + 1) (h:x) 0 ??  ? dir 35 dd 4 stop enable irq pin; stop oscillator i 0; stop oscillator ?? 0 ??? inh 8e 1 stx opr stx opr stx opr ,x stx opr ,x stx ,x stx opr ,sp stx opr ,sp store x in m m (x) 0 ??  ? dir ext ix2 ix1 ix sp1 sp2 bf cf df ef ff 9eef 9edf dd hh ll ee ff ff ff ee ff 3 4 4 3 2 4 5 sub # opr sub opr sub opr sub opr ,x sub opr ,x sub ,x sub opr ,sp sub opr ,sp subtract a (a) ? (m)  ??  imm dir ext ix2 ix1 ix sp1 sp2 a0 b0 c0 d0 e0 f0 9ee0 9ed0 ii dd hh ll ee ff ff ff ee ff 2 3 4 4 3 2 4 5 swi software interrupt pc (pc) + 1; push (pcl) sp (sp) ? 1; push (pch) sp (sp) ? 1; push (x) sp (sp) ? 1; push (a) sp (sp) ? 1; push (ccr) sp (sp) ? 1; i 1 pch interrupt vector high byte pcl interrupt vector low byte ?? 1 ??? inh 83 9 tap transfer a to ccr ccr (a)  inh 84 2 tax transfer a to x x (a) ?????? inh 97 1 table 5-1. instruction set summary (sheet 6 of 7) source form operation description effect on ccr address mode opcode operand cycles vh i nzc
central processor unit (cpu) opcode map MC68HC908RF2 ? rev. 1 advance information motorola central processor unit (cpu) 79 5.9 opcode map the opcode map is provided in table 5-2 . tpa transfer ccr to a a (ccr) ?????? inh 85 1 tst opr tsta tstx tst opr ,x tst ,x tst opr ,sp test for negative or zero (a) ? $00 or (x) ? $00 or (m) ? $00 0 ??  ? dir inh inh ix1 ix sp1 3d 4d 5d 6d 7d 9e6d dd ff ff 3 1 1 3 2 4 tsx transfer sp to h:x h:x (sp) + 1 ?????? inh 95 2 txa transfer x to a a (x) ?????? inh 9f 1 txs transfer h:x to sp (sp) (h:x) ? 1 ?????? inh 94 2 a accumulator n any bit c carry/borrow bit opr operand (one or two bytes) ccr condition code register pc program counter dd direct address of operand pch program counter high byte dd rr direct address of operand and relative offset of branch instruction pcl program counter low byte dd direct to direct addressing mode rel relative addressing mode dir direct addressing mode rel relative program counter offset byte dix+ direct to indexed with post increment addressing mode rr relative program counter offset byte ee ff high and low bytes of offset in indexed, 16-bit offset addressing sp1 stack pointer, 8-bit offset addressing mode ext extended addressing mode sp2 stack pointer 16-bit offset addressing mode ff offset byte in indexed, 8-bit offset addressing sp stack pointer h half-carry bit u undefined h index register high byte v overflow bit hh ll high and low bytes of operand address in extended addressing x index register low byte i interrupt mask z zero bit ii immediate operand byte & logical and imd immediate source to direct destination addressing mode | logical or imm immediate addressing mode logical exclusive or inh inherent addressing mode ( ) contents of ix indexed, no offset addressing mode ? ( ) negation (two ? s complement) ix+ indexed, no offset, post increment addressing mode # immediate value ix+d indexed with post increment to direct addressing mode ? sign extend ix1 indexed, 8-bit offset addressing mode loaded with ix1+ indexed, 8-bit offset, post increment addressing mode ? if ix2 indexed, 16-bit offset addressing mode : concatenated with m memory location  set or cleared n negative bit ? not affected table 5-1. instruction set summary (sheet 7 of 7) source form operation description effect on ccr address mode opcode operand cycles vh i nzc
advance information MC68HC908RF2 ? rev. 1 80 central processor unit (cpu) motorola central processor unit (cpu) table 5-2. opcode map bit manipulation branch read-modify-write control register/memory dir dir rel dir inh inh ix1 sp1 ix inh inh imm dir ext ix2 sp2 ix1 sp1 ix 0 12 3 4 5 69e67 8 9abcd9ede9eef 0 5 brset0 3dir 4 bset0 2dir 3 bra 2rel 4 neg 2dir 1 nega 1inh 1 negx 1inh 4 neg 2ix1 5 neg 3sp1 3 neg 1ix 7 rti 1inh 3 bge 2rel 2 sub 2imm 3 sub 2dir 4 sub 3ext 4 sub 3ix2 5 sub 4sp2 3 sub 2ix1 4 sub 3 sp1 2 sub 1ix 1 5 brclr0 3dir 4 bclr0 2dir 3 brn 2rel 5 cbeq 3dir 4 cbeqa 3imm 4 cbeqx 3imm 5 cbeq 3ix1+ 6 cbeq 4sp1 4 cbeq 2ix+ 4 rts 1inh 3 blt 2rel 2 cmp 2imm 3 cmp 2dir 4 cmp 3ext 4 cmp 3ix2 5 cmp 4sp2 3 cmp 2ix1 4 cmp 3 sp1 2 cmp 1ix 2 5 brset1 3dir 4 bset1 2dir 3 bhi 2rel 5 mul 1inh 7 div 1inh 3 nsa 1inh 2 daa 1inh 3 bgt 2rel 2 sbc 2imm 3 sbc 2dir 4 sbc 3ext 4 sbc 3ix2 5 sbc 4sp2 3 sbc 2ix1 4 sbc 3 sp1 2 sbc 1ix 3 5 brclr1 3dir 4 bclr1 2dir 3 bls 2rel 4 com 2dir 1 coma 1inh 1 comx 1inh 4 com 2ix1 5 com 3sp1 3 com 1ix 9 swi 1inh 3 ble 2rel 2 cpx 2imm 3 cpx 2dir 4 cpx 3ext 4 cpx 3ix2 5 cpx 4sp2 3 cpx 2ix1 4 cpx 3 sp1 2 cpx 1ix 4 5 brset2 3dir 4 bset2 2dir 3 bcc 2rel 4 lsr 2dir 1 lsra 1inh 1 lsrx 1inh 4 lsr 2ix1 5 lsr 3sp1 3 lsr 1ix 2 ta p 1inh 2 txs 1inh 2 and 2imm 3 and 2dir 4 and 3ext 4 and 3ix2 5 and 4sp2 3 and 2ix1 4 and 3 sp1 2 and 1ix 5 5 brclr2 3dir 4 bclr2 2dir 3 bcs 2rel 4 sthx 2dir 3 ldhx 3imm 4 ldhx 2dir 3 cphx 3imm 4 cphx 2dir 1 tpa 1inh 2 tsx 1inh 2 bit 2imm 3 bit 2dir 4 bit 3ext 4 bit 3ix2 5 bit 4sp2 3 bit 2ix1 4 bit 3 sp1 2 bit 1ix 6 5 brset3 3dir 4 bset3 2dir 3 bne 2rel 4 ror 2dir 1 rora 1inh 1 rorx 1inh 4 ror 2ix1 5 ror 3sp1 3 ror 1ix 2 pula 1inh 2 lda 2imm 3 lda 2dir 4 lda 3ext 4 lda 3ix2 5 lda 4sp2 3 lda 2ix1 4 lda 3 sp1 2 lda 1ix 7 5 brclr3 3dir 4 bclr3 2dir 3 beq 2rel 4 asr 2dir 1 asra 1inh 1 asrx 1inh 4 asr 2ix1 5 asr 3sp1 3 asr 1ix 2 psha 1inh 1 tax 1inh 2 ais 2imm 3 sta 2dir 4 sta 3ext 4 sta 3ix2 5 sta 4sp2 3 sta 2ix1 4 sta 3 sp1 2 sta 1ix 8 5 brset4 3dir 4 bset4 2dir 3 bhcc 2rel 4 lsl 2dir 1 lsla 1inh 1 lslx 1inh 4 lsl 2ix1 5 lsl 3sp1 3 lsl 1ix 2 pulx 1inh 1 clc 1inh 2 eor 2imm 3 eor 2dir 4 eor 3ext 4 eor 3ix2 5 eor 4sp2 3 eor 2ix1 4 eor 3 sp1 2 eor 1ix 9 5 brclr4 3dir 4 bclr4 2dir 3 bhcs 2rel 4 rol 2dir 1 rola 1inh 1 rolx 1inh 4 rol 2ix1 5 rol 3sp1 3 rol 1ix 2 pshx 1inh 1 sec 1inh 2 adc 2imm 3 adc 2dir 4 adc 3ext 4 adc 3ix2 5 adc 4sp2 3 adc 2ix1 4 adc 3 sp1 2 adc 1ix a 5 brset5 3dir 4 bset5 2dir 3 bpl 2rel 4 dec 2dir 1 deca 1inh 1 decx 1inh 4 dec 2ix1 5 dec 3sp1 3 dec 1ix 2 pulh 1inh 2 cli 1inh 2 ora 2imm 3 ora 2dir 4 ora 3ext 4 ora 3ix2 5 ora 4sp2 3 ora 2ix1 4 ora 3 sp1 2 ora 1ix b 5 brclr5 3dir 4 bclr5 2dir 3 bmi 2rel 5 dbnz 3dir 3 dbnza 2inh 3 dbnzx 2inh 5 dbnz 3ix1 6 dbnz 4sp1 4 dbnz 2ix 2 pshh 1inh 2 sei 1inh 2 add 2imm 3 add 2dir 4 add 3ext 4 add 3ix2 5 add 4sp2 3 add 2ix1 4 add 3 sp1 2 add 1ix c 5 brset6 3dir 4 bset6 2dir 3 bmc 2rel 4 inc 2dir 1 inca 1inh 1 incx 1inh 4 inc 2ix1 5 inc 3sp1 3 inc 1ix 1 clrh 1inh 1 rsp 1inh 2 jmp 2dir 3 jmp 3ext 4 jmp 3ix2 3 jmp 2ix1 2 jmp 1ix d 5 brclr6 3dir 4 bclr6 2dir 3 bms 2rel 3 tst 2dir 1 tsta 1inh 1 tstx 1inh 3 tst 2ix1 4 tst 3sp1 2 tst 1ix 1 nop 1inh 4 bsr 2rel 4 jsr 2dir 5 jsr 3ext 6 jsr 3ix2 5 jsr 2ix1 4 jsr 1ix e 5 brset7 3dir 4 bset7 2dir 3 bil 2rel 5 mov 3dd 4 mov 2dix+ 4 mov 3imd 4 mov 2ix+d 1 stop 1inh * 2 ldx 2imm 3 ldx 2dir 4 ldx 3ext 4 ldx 3ix2 5 ldx 4sp2 3 ldx 2ix1 4 ldx 3 sp1 2 ldx 1ix f 5 brclr7 3dir 4 bclr7 2dir 3 bih 2rel 3 clr 2dir 1 clra 1inh 1 clrx 1inh 3 clr 2ix1 4 clr 3sp1 2 clr 1ix 1 wait 1inh 1 txa 1inh 2 aix 2imm 3 stx 2dir 4 stx 3ext 4 stx 3ix2 5 stx 4sp2 3 stx 2ix1 4 stx 3 sp1 2 stx 1ix inh inherent rel relative sp1 stack pointer, 8-bit offset imm immediate ix indexed, no offset sp2 stack pointer, 16-bit offset dir direct ix1 indexed, 8-bit offset ix+ indexed, no offset with ext extended ix2 indexed, 16-bit offset post increment dd direct-direct imd immediate-direct ix1+ indexed, 1-byte offset with ix+d indexed-direct dix+ direct-indexed post increment * pre-byte for stack pointer indexed instructions 0 high byte of opcode in hexadecimal low byte of opcode in hexadecimal 0 5 brset0 3dir cycles opcode mnemonic number of bytes / addressing mode msb lsb msb lsb
MC68HC908RF2 ? rev. 1 advance information motorola system integration module (sim) 81 advance information ? MC68HC908RF2 section 6. system integration module (sim) 6.1 contents 6.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .82 6.3 sim bus clock control and generation . . . . . . . . . . . . . . . . . .85 6.3.1 bus timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .85 6.3.2 clock startup from por or lvi reset . . . . . . . . . . . . . . . . .85 6.3.3 clocks in stop mode and wait mode . . . . . . . . . . . . . . . . . . 86 6.4 reset and system initialization. . . . . . . . . . . . . . . . . . . . . . . . .86 6.4.1 external pin reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .87 6.4.2 active resets from internal sources . . . . . . . . . . . . . . . . . .88 6.4.2.1 power-on reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .89 6.4.2.2 computer operating properly (cop) reset. . . . . . . . . . .90 6.4.2.3 illegal opcode reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 6.4.2.4 illegal address reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 6.4.2.5 low-voltage inhibit (lvi) reset . . . . . . . . . . . . . . . . . . . .90 6.5 sim counter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .91 6.5.1 sim counter during power-on reset . . . . . . . . . . . . . . . . .91 6.5.2 sim counter during stop mode recovery . . . . . . . . . . . . . .91 6.5.3 sim counter and reset states. . . . . . . . . . . . . . . . . . . . . . .91 6.6 program exception control. . . . . . . . . . . . . . . . . . . . . . . . . . . .92 6.6.1 interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .92 6.6.1.1 hardware interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . .94 6.6.1.2 swi instruction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .95 6.6.2 reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .95 6.6.3 break interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .95 6.6.4 status flag protection in break mode . . . . . . . . . . . . . . . . .96 6.7 low-power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .96 6.7.1 wait mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .96 6.7.2 stop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .98
advance information MC68HC908RF2 ? rev. 1 82 system integration module (sim) motorola system integration module (sim) 6.8 sim registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .99 6.8.1 sim break status register . . . . . . . . . . . . . . . . . . . . . . . . . . 99 6.8.2 sim reset status register . . . . . . . . . . . . . . . . . . . . . . . .100 6.8.3 sim break flag control register . . . . . . . . . . . . . . . . . . . . 101 6.2 introduction this section describes the system integration module (sim). together with the central processor unit (cpu), the sim controls all mcu activities. the sim is a system state controller that coordinates cpu and exception timing. a block diagram of the sim is shown in figure 6-1 . figure 6-2 is a summary of the sim input/output (i/o) registers. the sim is responsible for:  bus clock generation and control for cpu and peripherals: ? stop/wait/reset/break entry and recovery ? internal clock control  master reset control, including power-on reset (por) and computer operating properly (cop) timeout  interrupt control: ? acknowledge timing ? arbitration control timing ? vector address generation  cpu enable/disable timing
system integration module (sim) introduction MC68HC908RF2 ? rev. 1 advance information motorola system integration module (sim) 83 figure 6-1. sim block diagram stop/wait clock control clock generators por control reset pin control sim reset status register interrupt control and priority decode module stop module wait cpu stop (from cpu) cpu wait (from cpu) simoscen (to icg) cgmout (from icg) internal clocks master reset control reset pin logic lvi (from lvi module) illegal opcode (from cpu) illegal address (from address map decoders) cop (from cop module) interrupt sources cpu interface reset control sim counter cop clock cgmxclk (from icg) 2
advance information MC68HC908RF2 ? rev. 1 84 system integration module (sim) motorola system integration module (sim) table 6-1 shows the internal signal names used in this section. addr.register name bit 7654321bit 0 $fe00 sim break status register (sbsr) s ee page 99 . read: rrrrrr sbsw r write: see note reset: 0 note: writing a logic 0 clears sbsw $fe01 sim reset status register (srsr) s ee page 10 0 . read: por pin cop ilop ilad 0 lvi 0 write: por:1xxxxxxx $fe02 sim break flag control register (sbfcr) s ee page 10 1 . read: bcferrrrrrr write: reset:00000000 = unimplemented r = reserved x = indeterminate figure 6-2. sim i/o register summary table 6-1. signal name conventions signal name description cgmxclk selected clock source from internal clock generator module (icg) cgmout clock output from icg module bus clock = cgmout divided by two iclk output from internal clock generator eclk external clock source iab internal address bus idb internal data bus porrst signal from the power-on reset module to the sim irst internal reset signal r/w read/write signal
system integration module (sim) sim bus clock control and generation MC68HC908RF2 ? rev. 1 advance information motorola system integration module (sim) 85 6.3 sim bus clock control and generation the bus clock generator provides system clock signals for the cpu and peripherals on the mcu. the system clocks are generated from an incoming clock, cgmout, as shown in figure 6-3 . this clock can come from either an external oscillator or from the internal clock generator (icg) module. 6.3.1 bus timing in user mode , the internal bus frequency is either the crystal oscillator output (eclk) divided by four or the icg output (iclk) divided by four. 6.3.2 clock startup from por or lvi reset when the power-on reset (por) module or the low-voltage inhibit (lvi) module generates a reset, the clocks to the cpu and peripherals are inactive and held in an inactive phase until after 4096 cgmxclk cycles. the rst pin is driven low by the sim during this entire period. the bus clocks start upon completion of the timeout. figure 6-3. icg clock signals icg cgmxclk 2 bus clock generators sim icg sim counter ptb3 monitor mode clock select circuit iclk cs 2 a b s* cgmout *when s = 1, cgmout = b user mode generator eclk
advance information MC68HC908RF2 ? rev. 1 86 system integration module (sim) motorola system integration module (sim) 6.3.3 clocks in stop mode and wait mode upon exit from stop mode by an interrupt, break, or reset, the sim allows cgmxclk to clock the sim counter. the cpu and peripheral clocks do not become active until after the stop delay timeout. this timeout is selectable as 4096 or 32 cgmxclk cycles. (see 6.7.2 stop mode .) in wait mode, the cpu clocks are inactive. refer to the wait mode subsection of each module to see if the module is active or inactive in wait mode. some modules can be programmed to be active in wait mode. 6.4 reset and system initialization the mcu has these reset sources:  power-on reset module (por)  external reset pin (rst )  computer operating properly module (cop)  low-voltage inhibit module (lvi)  illegal opcode  illegal address all of these resets produce the vector $fffe ? ffff ($fefe ? feff in monitor mode) and assert the internal reset signal (irst). irst causes all registers to be returned to their default values and all modules to be returned to their reset states. an internal reset clears the sim counter (see 6.5 sim counter ), but an external reset does not. each of the resets sets a corresponding bit in the sim reset status register (srsr). (see 6.8 sim registers .)
system integration module (sim) reset and system initialization MC68HC908RF2 ? rev. 1 advance information motorola system integration module (sim) 87 6.4.1 external pin reset pulling the asynchronous rst pin low halts all processing. the pin bit of the sim reset status register (srsr) is set as long as rst is held low for a minimum of 67 cgmxclk cycles, assuming that neither the por nor the lvi was the source of the reset. figure 6-4 shows the relative timing of an external reset recovery. figure 6-4. external reset recovery timing iab pc vect h vect l cgmout pulled low external rst pulled high external
advance information MC68HC908RF2 ? rev. 1 88 system integration module (sim) motorola system integration module (sim) 6.4.2 active resets from internal sources all internal reset sources actively pull the rst pin low for 32 cgmxclk cycles to allow resetting of external peripherals. the internal reset signal irst continues to be asserted for an additional 32 cycles. (see figure 6-5 .) an internal reset can be caused by an illegal address, illegal opcode, cop timeout, lvi, or por. (see figure 6-6 .) note that for lvi or por resets, the sim cycles through 4096 cgmxclk cycles during which the sim forces the rst pin low. the internal reset signal then follows the sequence from the falling edge of rst shown in figure 6-5 . the cop reset is asynchronous to the bus clock. the active reset feature allows the part to issue a reset to peripherals and other chips within a system built around the mcu. figure 6-5. internal reset timing figure 6-6. sources of internal reset irst rst rst pulled low by mcu iab 32 cycles 32 cycles vector high cgmxclk illegal address rst illegal opcode rst coprst lvi por internal reset
system integration module (sim) reset and system initialization MC68HC908RF2 ? rev. 1 advance information motorola system integration module (sim) 89 6.4.2.1 power-on reset when power is first applied to the mcu, the power-on reset module (por) generates a pulse to indicate that power-on has occurred. the external reset pin (rst ) is held low while the sim counter counts out 4096 cgmxclk cycles. another 64 cgmxclk cycles later, the cpu and memories are released from reset to allow the reset vector sequence to occur. at power-on, these events occur:  a por pulse is generated.  the internal reset signal is asserted.  the sim enables cgmout.  internal clocks to the cpu and modules are held inactive for 4096 cgmxclk cycles to allow stabilization of the oscillator.  the rst pin is driven low during the oscillator stabilization time.  the por bit of the sim reset status register (srsr) is set and all other bits in the register are cleared. figure 6-7. por recovery porrst osc1 cgmxclk cgmout rst iab 4096 cycles 32 cycles 32 cycles $fffe $ffff
advance information MC68HC908RF2 ? rev. 1 90 system integration module (sim) motorola system integration module (sim) 6.4.2.2 computer operating properly (cop) reset the overflow of the cop counter causes an internal reset and sets the cop bit in the sim reset status register (srsr) if the copd bit in the config register is at logic 0. (see section 11. computer operating properly module (cop) .) 6.4.2.3 illegal opcode reset the sim decodes signals from the cpu to detect illegal instructions. an illegal instruction sets the ilop bit in the sim reset status register (srsr) and causes a reset. if the stop enable bit, stop, in the configuration register (config) is logic 0, the sim treats the stop instruction as an illegal opcode and causes an illegal opcode reset. 6.4.2.4 illegal address reset an opcode fetch from an unmapped address generates an illegal address reset. the sim verifies that the cpu is fetching an opcode prior to asserting the ilad bit in the sim reset status register (srsr) and resetting the mcu. a data fetch from an unmapped address does not generate a reset. 6.4.2.5 low-voltage inhibit (lvi) reset the low-voltage inhibit module (lvi) asserts its output to the sim when the v dd voltage falls to the v lvr voltage. the lvi bit in the sim reset status register (srsr) is set and a chip reset is asserted if the lvipwrd and lvirstd bits in the config register are at logic 0. the rst pin will be held low until the sim counts 4096 cgmxclk cycles after v dd rises above v lvr + h lvr . another 64 cgmxclk cycles later, the cpu is released from reset to allow the reset vector sequence to occur. (see section 12. low-voltage inhibit (lvi) .)
system integration module (sim) sim counter MC68HC908RF2 ? rev. 1 advance information motorola system integration module (sim) 91 6.5 sim counter the sim counter is used by the power-on reset module (por) and in stop mode recovery to allow the oscillator time to stabilize before enabling the internal bus (ibus) clocks. the sim counter also serves as a prescaler for the computer operating properly module (cop). the sim counter overflow supplies the clock for the cop module. the sim counter is 12 bits long and is clocked by the falling edge of cgmxclk. 6.5.1 sim counter during power-on reset the power-on reset module (por) detects power applied to the mcu. at power-on, the por circuit asserts the signal porrst. once the sim is initialized, it enables the internal clock generation module (icg) to drive the bus clock state machine. 6.5.2 sim counter during stop mode recovery the sim counter also is used for stop mode recovery. the stop instruction clears the sim counter. after an interrupt, break, or reset, the sim senses the state of the short stop recovery bit, ssrec, in the config register. if the ssrec bit is a logic 1, then the stop recovery is reduced from the normal delay of 4096 cgmxclk cycles down to 32 cgmxclk cycles. this is ideal for applications using canned oscillators that do not require long startup times from stop mode. external crystal applications should use the full stop recovery time, that is, with ssrec cleared. 6.5.3 sim counter and reset states external reset has no effect on the sim counter. see 6.7.2 stop mode for details. the sim counter is free-running after all reset states. see 6.4.2 active resets from internal sources for counter control and internal reset recovery sequences.
advance information MC68HC908RF2 ? rev. 1 92 system integration module (sim) motorola system integration module (sim) 6.6 program exception control normal, sequential program execution can be changed in three different ways: 1. interrupts: a. maskable hardware cpu interrupts b. non-maskable software interrupt instruction (swi) 2. reset 3. break interrupts 6.6.1 interrupts at the beginning of an interrupt, the cpu saves the cpu register contents on the stack and sets the interrupt mask (i bit) to prevent additional interrupts. at the end of an interrupt, the rti instruction recovers the cpu register contents from the stack so that normal processing can resume. figure 6-8 shows interrupt entry timing. figure 6-10 shows interrupt recovery timing. interrupts are latched, and arbitration is performed in the sim at the start of interrupt processing. the arbitration result is a constant that the cpu uses to determine which vector to fetch. once an interrupt is latched by the sim, no other interrupt can take precedence, regardless of priority, until the latched interrupt is serviced (or the i bit is cleared). (see figure 6-9 .) figure 6-8 . interrupt entry module idb r/w interrupt dummy sp sp ? 1 sp ? 2 sp ? 3 sp ? 4 vect h vect l start addr iab dummy pc ? 1[7:0] pc ? 1[15:8] x a ccr v data h v data l opcode i bit
system integration module (sim) program exception control MC68HC908RF2 ? rev. 1 advance information motorola system integration module (sim) 93 figure 6-9. interrupt processing no no no yes no no yes yes as many interrupts i bit set? from reset break interrupt? i bit set? irq interrupt? swi instruction? rti instruction? fetch next instruction unstack cpu registers stack cpu registers set i bit load pc with interrupt vector execute instruction yes yes as exist on chip
advance information MC68HC908RF2 ? rev. 1 94 system integration module (sim) motorola system integration module (sim) figure 6-10. interrupt recovery 6.6.1.1 hardware interrupts a hardware interrupt does not stop the current instruction. processing of a hardware interrupt begins after completion of the current instruction. when the current instruction is complete, the sim checks all pending hardware interrupts. if interrupts are not masked (i bit clear in the condition code register), and if the corresponding interrupt enable bit is set, the sim proceeds with interrupt processing; otherwise, the next instruction is fetched and executed. if more than one interrupt is pending at the end of an instruction execution, the highest priority interrupt is serviced first. figure 6-11 demonstrates what happens when two interrupts are pending. if an interrupt is pending upon exit from the original interrupt service routine, the pending interrupt is serviced before the lda instruction is executed. the lda opcode is prefetched by both the int1 and int2 rti instructions. however, in the case of the int1 rti prefetch, this is a redundant operation. note: to maintain compatibility with the m68hc05, m6805, and m146805 families, the h register is not pushed on the stack during interrupt entry. if the interrupt service routine modifies the h register or uses the indexed addressing mode, software should save the h register and then restore it prior to exiting the routine. module idb r/w interrupt sp ? 4 sp ? 3 sp ? 2 sp ? 1 sp pc pc + 1 iab ccr a x pc ? 1 [15:8] pc ? 1 [7 : 0] opcode operand i bit
system integration module (sim) program exception control MC68HC908RF2 ? rev. 1 advance information motorola system integration module (sim) 95 figure 6-11 . interrupt recognition example 6.6.1.2 swi instruction the swi instruction is a non-maskable instruction that causes an interrupt regardless of the state of the interrupt mask (i bit) in the condition code register. note: a software interrupt pushes pc onto the stack. a software interrupt does not push pc ? 1, as a hardware interrupt does. 6.6.2 reset all reset sources always have higher priority than interrupts and cannot be arbitrated. 6.6.3 break interrupts the break module can stop normal program flow at a software- programmable break point by asserting its break interrupt output. (see section 7. break module (brk) .) the sim puts the cpu into the break state by forcing it to the swi vector location. refer to the break interrupt cli lda int1 pulh rti int2 background #$ff pshh int1 interrupt service routine pulh rti pshh int2 interrupt service routine routine
advance information MC68HC908RF2 ? rev. 1 96 system integration module (sim) motorola system integration module (sim) subsection of each module to see how each module is affected by the break state. 6.6.4 status flag protection in break mode the sim controls whether status flags contained in other modules can be cleared during break mode. the user can select whether flags are protected from being cleared by properly initializing the break clear flag enable bit (bcfe) in the break flag control register (bfcr). protecting flags in break mode ensures that set flags will not be cleared while in break mode. this protection allows registers to be freely read and written during break mode without losing status flag information. setting the bcfe bit enables the clearing mechanisms. once cleared in break mode, a flag remains cleared even when break mode is exited. status flags with a 2-step clearing mechanism ? for example, a read of one register followed by the read or write of another ? are protected, even when the first step is accomplished prior to entering break mode. upon leaving break mode, execution of the second step will clear the flag as normal. 6.7 low-power modes executing the wait or stop instruction puts the mcu in a low power- consumption mode for standby situations. the sim holds the cpu in a non-clocked state. the operation of each of these modes is described here. both stop and wait clear the interrupt mask (i) in the condition code register, allowing interrupts to occur. 6.7.1 wait mode in wait mode, the cpu clocks are inactive while one set of peripheral clocks continues to run. figure 6-12 shows the timing for wait mode entry. a module that is active during wait mode can wake up the cpu with an interrupt if the interrupt is enabled. stacking for the interrupt begins one
system integration module (sim) low-power modes MC68HC908RF2 ? rev. 1 advance information motorola system integration module (sim) 97 cycle after the wait instruction during which the interrupt occurred. refer to the wait mode subsection of each module to see if the module is active or inactive in wait mode. some modules can be programmed to be active in wait mode. wait mode can also be exited by a reset or break. a break interrupt during wait mode sets the sim break stop/wait bit, sbsw, in the sim break status register (sbsr). if the cop disable bit, copd, in the mask option register is logic 0, then the computer operating properly module (cop) is enabled and remains active in wait mode. figure 6-12. wait mode entry timing figure 6-13 and figure 6-14 show the timing for wait recovery. figure 6-13. wait recovery from interrupt or break figure 6-14. wait recovery from internal reset wait addr + 1 same same iab idb previous data next opcode same wait addr same r/w note: previous data can be operand data or the wait opcode, depending on the last instruction. $6e0c $6e0b $00ff $00fe $00fd $00fc $a6 $a6 $01 $0b $6e $a6 iab idb exitstopwait note: exitstopwait = rst pin or cpu interrupt or break interrupt iab idb rst $a6 $a6 $6e0b rst vct h rst vct l $a6 cgmxclk 32 cycles 32 cycles
advance information MC68HC908RF2 ? rev. 1 98 system integration module (sim) motorola system integration module (sim) 6.7.2 stop mode in stop mode, the sim counter is reset and the system clocks are disabled. an interrupt request from a module can cause an exit from stop mode. stacking for interrupts begins after the selected stop recovery time has elapsed. reset or break also causes an exit from stop mode. the sim disables the clock generator module outputs (cgmout and cgmxclk) in stop mode, stopping the cpu and peripherals. stop recovery time is selectable using the ssrec bit in the config register. if ssrec is set, stop recovery is reduced from the normal delay of 4096 cgmxclk cycles down to 32. this is ideal for applications using canned oscillators that do not require long startup times from stop mode. note: external crystal applications should use the full stop recovery time by clearing the ssrec bit. a break interrupt during stop mode sets the sim break stop/wait bit (sbsw) in the sim break status register (sbsr). the sim counter is held in reset from the execution of the stop instruction until the beginning of stop recovery. it is then used to time the recovery period. figure 6-15 shows stop mode entry timing. figure 6-15. stop mode entry timing figure 6-16. stop mode recovery from interrupt or break stop addr + 1 same same iab idb previous data next opcode same stop addr same r/w cpustop note: previous data can be operand data or the stop opcode, depending on the last instruction. cgmxclk int/break iab stop + 2 stop + 2 sp sp ? 1 sp ? 2 sp ? 3 stop +1 stop recovery period
system integration module (sim) sim registers MC68HC908RF2 ? rev. 1 advance information motorola system integration module (sim) 99 6.8 sim registers the sim has three memory mapped registers:  sim break status register, sbsr  sim reset status register, srsr  sim break flag control register, sbfcr 6.8.1 sim break status register the sim break status register (sbsr) contains a flag to indicate that a break caused an exit from stop or wait mode. sbsw ? sim break stop/wait bit this status bit is useful in applications requiring a return to wait or stop mode after exiting from a break interrupt. clear sbsw by writing a logic 0 to it. reset clears sbsw. 1 = stop mode or wait mode was exited by break interrupt. 0 = stop mode or wait mode was not exited by break interrupt. sbsw can be read within the break state swi routine. the user can modify the return address on the stack by subtracting one from it. (see code example.) writing 0 to the sbsw bit clears it. ;this code works if the h register has been pushed onto the stack in the break ;service routine software. this code should be executed at the end of the ;break service routine software. hibyte equ 5 lobyte equ 6 ; if not sbsw, do rti brclr sbsw, sbsr, return ;see if wait mode or stop mode was exited ;by break. tst lobyte,sp ;if returnlo is not zero, bne dolo ;then just decrement low byte. dec hibyte,sp ;else deal with high byte, too. dolo dec lobyte,sp ;point to wait/stop opcode. return pulh rti ;restore h register. address: $fe00 bit 7654321bit 0 read: rrrrrr sbsw r write: see note reset: 0 r = reserved note: writing a logic 0 clears sbsw. figure 6-17. sim break status register (sbsr)
advance information MC68HC908RF2 ? rev. 1 100 system integration module (sim) motorola system integration module (sim) 6.8.2 sim reset status register this register contains six flags that show the source of the last reset. the status register will clear automatically after reading it. a power-on reset sets the por bit. por ? power-on reset bit 1 = last reset caused by por circuit 0 = read of srsr pin ? external reset bit 1 = last reset caused by external reset pin (rst ) 0 = read of srsr cop ? computer operating properly reset bit 1 = last reset caused by cop counter 0 = read of srsr ilop ? illegal opcode reset bit 1 = last reset caused by an illegal opcode 0 = read of srsr ilad ? illegal address reset bit (opcode fetches only) 1 = last reset caused by an opcode fetch from an illegal address 0 = read of srsr lvi ? low-voltage inhibit reset bit 1 = last reset was caused by the lvi circuit 0 = read of srsr address: $fe01 bit 7654321bit 0 read: por pin cop ilop ilad 0 lvi 0 write: por:1xxxxxxx = unimplemented x = indeterminate figure 6-18. sim reset status register (srsr)
system integration module (sim) sim registers MC68HC908RF2 ? rev. 1 advance information motorola system integration module (sim) 101 6.8.3 sim break flag control register the sim break control register contains a bit that enables software to clear status bits while the mcu is in a break state. bcfe ? break clear flag enable bit this read/write bit enables software to clear status bits by accessing status registers while the mcu is in a break state. to clear status bits during the break state, the bcfe bit must be set. 1 = status bits clearable during break 0 = status bits not clearable during break address: $fe02 bit 7654321bit 0 read: bcferrrrrrr write: reset:00000000 r= reserved figure 6-19. sim break flag control register (sbfcr)
advance information MC68HC908RF2 ? rev. 1 102 system integration module (sim) motorola system integration module (sim)
MC68HC908RF2 ? rev. 1 advance information motorola break module (brk) 103 advance information ? MC68HC908RF2 section 7. break module (brk) 7.1 contents 7.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .103 7.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .103 7.4 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .104 7.4.1 flag protection during break interrupts . . . . . . . . . . . . . . .105 7.4.2 cpu during break interrupts . . . . . . . . . . . . . . . . . . . . . . .105 7.4.3 tim during break interrupts . . . . . . . . . . . . . . . . . . . . . . . .106 7.4.4 cop during break interrupts . . . . . . . . . . . . . . . . . . . . . . .106 7.5 low-power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .106 7.5.1 wait mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .106 7.5.2 stop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .106 7.6 break module registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . .106 7.6.1 break status and control register . . . . . . . . . . . . . . . . . . .107 7.6.2 break address registers . . . . . . . . . . . . . . . . . . . . . . . . . .108 7.2 introduction the break module can generate a break interrupt that stops normal program flow at a defined address to enter a background program. 7.3 features features of the break module (brk) include:  accessible input/output (i/o) registers during break interrupts  cpu-generated break interrupts  software-generated break interrupts  cop disabling during break interrupts
advance information MC68HC908RF2 ? rev. 1 104 break module (brk) motorola break module (brk) 7.4 functional description when the internal address bus matches the value written in the break address registers, the break module issues a breakpoint signal to the cpu. the cpu then loads the instruction register with a software interrupt instruction (swi) after completion of the current cpu instruction. the program counter vectors to $fffc and $fffd ($fefc and $fefd in monitor mode). these events can cause a break interrupt to occur:  a cpu-generated address (the address in the program counter) matches the contents of the break address registers.  software writes a logic 1 to the brka bit in the break status and control register. when a cpu-generated address matches the contents of the break address registers, the break interrupt begins after the cpu completes its current instruction. a return-from-interrupt instruction (rti) in the break routine ends the break interrupt and returns the mcu to normal operation. figure 7-1 shows the structure of the break module. figure 7-1. break module block diagram iab[15:8] iab[7:0] 8-bit comparator 8-bit comparator control break address register low break address register high iab[15:0] break
break module (brk) functional description MC68HC908RF2 ? rev. 1 advance information motorola break module (brk) 105 7.4.1 flag protection during break interrupts the system integration module (sim) controls whether module status bits can be cleared during the break state. the bcfe bit in the sim break flag control register (bfcr) enables software to clear status bits during the break state. (see 6.8.3 sim break flag control register and the break interrupts subsection for each module.) 7.4.2 cpu during break interrupts the cpu starts a break interrupt by:  loading the instruction register with the swi instruction  loading the program counter with $fffc and $fffd ($fefc and $fefd in monitor mode) the break interrupt begins after completion of the cpu instruction in progress. if the break address register match occurs on the last cycle of a cpu instruction, the break interrupt begins immediately. addr.register name bit 7654321bit 0 $fe0c break address register high (brkh) see page 108. read: bit 15 14 13 12 11 10 9 bit 8 write: reset:00000000 $fe0d break address register low (brkl) see page 108. read: bit 7654321bit 0 write: reset:00000000 $fe0e break status and control register (bscr) see page 107. read: brke brka 000000 write: reset:00000000 = unimplemented figure 7-2. i/o register summary
advance information MC68HC908RF2 ? rev. 1 106 break module (brk) motorola break module (brk) 7.4.3 tim during break interrupts a break interrupt stops the timer counter. 7.4.4 cop during break interrupts the cop is disabled during a break interrupt when v hi is present on the rst pin. 7.5 low-power modes the wait and stop instructions put the mcu in low power- consumption standby modes. 7.5.1 wait mode if enabled, the break module is active in wait mode. 7.5.2 stop mode the break module is inactive in stop mode. the stop instruction does not affect break module register states. 7.6 break module registers these registers control and monitor operation of the break module:  break status and control register, bscr  break address register high, brkh  break address register low, brkl
break module (brk) break module registers MC68HC908RF2 ? rev. 1 advance information motorola break module (brk) 107 7.6.1 break status and control register the break status and control register (bscr) contains break module enable and status bits. brke ? break enable bit this read/write bit enables breaks on break address register matches. clear brke by writing a logic 0 to bit 7. reset clears the brke bit. 1 = breaks enabled on 16-bit address match 0 = breaks disabled on 16-bit address match brka ? break active bit this read/write status and control bit is set when a break address match occurs. writing a logic 1 to brka generates a break interrupt. clear brka by writing a logic 0 to it before exiting the break routine. 1 = break address match 0 = no break address match address: $fe0e bit 7654321bit 0 read: brke brka 000000 write: reset:00000000 = unimplemented figure 7-3. break status and control register (bscr)
advance information MC68HC908RF2 ? rev. 1 108 break module (brk) motorola break module (brk) 7.6.2 break address registers the break address registers contain the high and low bytes of the desired breakpoint address. reset clears the break address registers. register name and address: brkh ? $fe0c bit 7654321bit 0 read: bit 15 14 13 12 11 10 9 bit 8 write: reset:00000000 register name and address: brkl ? $fe0d bit 7654321bit 0 read: bit 7654321bit 0 write: reset:00000000 figure 7-4. break address registers (brkh and brkl)
MC68HC908RF2 ? rev. 1 advance information motorola internal clock generator module (icg) 109 advance information ? MC68HC908RF2 section 8. internal clock generator module (icg) 8.1 contents 8.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .110 8.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .110 8.4 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .111 8.4.1 clock enable circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 8.4.2 internal clock generator . . . . . . . . . . . . . . . . . . . . . . . . . .113 8.4.2.1 digitally controlled oscillator . . . . . . . . . . . . . . . . . . . . . 114 8.4.2.2 modulo n divider . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .114 8.4.2.3 frequency comparator . . . . . . . . . . . . . . . . . . . . . . . . .114 8.4.2.4 digital loop filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .115 8.4.3 external clock generator . . . . . . . . . . . . . . . . . . . . . . . . . .116 8.4.3.1 external oscillator amplifier . . . . . . . . . . . . . . . . . . . . . . 116 8.4.3.2 external clock input path . . . . . . . . . . . . . . . . . . . . . . .117 8.4.4 clock monitor circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 8.4.4.1 clock monitor reference generator . . . . . . . . . . . . . . .118 8.4.4.2 internal clock activity detector . . . . . . . . . . . . . . . . . . . 121 8.4.4.3 external clock activity detector . . . . . . . . . . . . . . . . . . .121 8.4.5 clock selection circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . .122 8.4.5.1 clock selection switch. . . . . . . . . . . . . . . . . . . . . . . . . . 122 8.4.5.2 clock switching circuit. . . . . . . . . . . . . . . . . . . . . . . . . . 123 8.5 usage notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .124 8.5.1 switching clock sources . . . . . . . . . . . . . . . . . . . . . . . . . . 125 8.5.2 enabling the clock monitor . . . . . . . . . . . . . . . . . . . . . . . .126 8.5.3 clock monitor interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . .127 8.5.4 quantization error in dco output . . . . . . . . . . . . . . . . . . .127 8.5.4.1 digitally controlled oscillator . . . . . . . . . . . . . . . . . . . . . 128 8.5.4.2 binary weighted divider . . . . . . . . . . . . . . . . . . . . . . . .128 8.5.4.3 variable-delay ring oscillator . . . . . . . . . . . . . . . . . . . . 129 8.5.4.4 ring oscillator fine-adjust circuit . . . . . . . . . . . . . . . . . 129 8.5.5 switching internal clock frequencies . . . . . . . . . . . . . . . .130
advance information MC68HC908RF2 ? rev. 1 110 internal clock generator module (icg) motorola internal clock generator module (icg) 8.5.6 nominal frequency settling time . . . . . . . . . . . . . . . . . . .131 8.5.6.1 settling to within 15 percent . . . . . . . . . . . . . . . . . . . . .131 8.5.6.2 settling to within 5 percent . . . . . . . . . . . . . . . . . . . . . .132 8.5.6.3 total settling time . . . . . . . . . . . . . . . . . . . . . . . . . . . . .132 8.5.7 improving settling time . . . . . . . . . . . . . . . . . . . . . . . . . . .133 8.5.8 trimming frequency on the internal clock generator . . . .135 8.6 low-power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .137 8.6.1 wait mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .137 8.6.2 stop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .137 8.7 configuration register option . . . . . . . . . . . . . . . . . . . . . . . .137 8.7.1 extslow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .138 8.8 i/o registers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .138 8.8.1 icg control register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 8.8.2 icg multiplier register . . . . . . . . . . . . . . . . . . . . . . . . . . . .143 8.8.3 icg trim register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144 8.8.4 icg dco divider register . . . . . . . . . . . . . . . . . . . . . . . . .145 8.8.5 icg dco stage register . . . . . . . . . . . . . . . . . . . . . . . . . . 146 8.2 introduction the internal clock generator module (icg) is used to create a stable clock source for the microcontroller without using any external components. the icg generates the oscillator output clock (cgmxclk), which is used by the cop, lvi, and other modules. the icg also generates the clock generator output (cgmout), which is fed to the system integration module (sim) to create the bus clocks. the bus frequency will be one-fourth the frequency of cgmxclk and one-half the frequency of cgmout. 8.3 features the icg has these features:  external clock generator, either 1-pin external source or 2-pin crystal  internal clock generator with programmable frequency output in integer multiples of a nominal frequency (307.2 khz 25 percent)
internal clock generator module (icg) functional description MC68HC908RF2 ? rev. 1 advance information motorola internal clock generator module (icg) 111  frequency adjust (trim) register to improve variability to 2 percent  bus clock software selectable from either internal or external clock  clock monitor for both internal and external clocks 8.4 functional description the icg, shown in figure 8-1 , contains these major submodules:  clock enable circuit  internal clock generator  external clock generator  clock monitor circuit  clock selection circuit 8.4.1 clock enable circuit the clock enable circuit is used to enable the internal clock (iclk) or external clock (eclk). the clock enable circuit generates an icg stop (icgstop) signal which stops all clocks (iclk, eclk, and the low- frequency base clock, ibase) low. icgstop is set and the icg is disabled in stop mode. the internal clock enable signal (icgen) turns on the internal clock generator which generates iclk. icgen is set (active) whenever the icgon bit is set and the icgstop signal is clear. when icgen is clear, iclk and ibase are both low. the external clock enable signal (ecgen) turns on the external clock generator which generates eclk. ecgen is set (active) whenever the ecgon bit is set and the icgstop signal is clear. when ecgen is clear, eclk is low.
advance information MC68HC908RF2 ? rev. 1 112 internal clock generator module (icg) motorola internal clock generator module (icg) figure 8-1. icg module block diagram internal to mcu external external clock generator ecgs osc1 osc2 simoscen ibase icgs cmon cpu_int n[6:0] trim[7:0] clock monitor/switcher circuit cmf eclk iclk clock selection eoff ioff cgmxclk cs cgmout extslow clock enable circuit icgon ecgon ecgen icgen dstg reset ddiv name name name name configuration register bit top level signal register bit module signal circuit internal clock generator
internal clock generator module (icg) functional description MC68HC908RF2 ? rev. 1 advance information motorola internal clock generator module (icg) 113 8.4.2 internal clock generator the internal clock generator, shown in figure 8-2 , creates a low- frequency base clock (ibase), which operates at a nominal frequency (f nom ) of 307.2 khz 25 percent, and an internal clock (iclk) which is an integer multiple of ibase. this multiple is the icg multiplier factor (n), which is programmed in the icg multiplier register (icgmr). the internal clock generator is turned off and the output clocks (ibase and iclk) are held low when the internal clock generator enable signal (icgen) is clear. the internal clock generator contains:  a digitally controlled oscillator  a modulo n divider  a frequency comparator, which contains voltage and current references, a frequency to voltage converter, and comparators  a digital loop filter figure 8-2. internal clock generator block diagram digitally controlled oscillator iclk modulo n divider frequency comparator clock generator trim[7:0] voltage & current references digital loop filter ++ + ? ? ? n[6:0] dstg[7:0] icgen ibase ddiv[3:0] name name register bit module signal
advance information MC68HC908RF2 ? rev. 1 114 internal clock generator module (icg) motorola internal clock generator module (icg) 8.4.2.1 digitally controlled oscillator the digitally controlled oscillator (dco) is an inaccurate oscillator which generates the internal clock (iclk). the clock period of iclk is dependent on the digital loop filter outputs (dstg[7:0] and ddiv[3:0]). because there is only a limited number of bits in ddiv and dstg, the precision of the output (iclk) is restricted to a long-term precision of approximately 0.202 percent to 0.368 percent when measured over several cycles (of the desired frequency). additionally, since the propagation delays of the devices used in the dco ring oscillator are a measurable fraction of the bus clock period, reaching the long-term precision may require alternately running faster and slower than desired, making the worst case cycle-to-cycle frequency variation 6.45 percent to 11.8 percent (of the desired frequency). the valid values of ddiv:dstg range from $000 to $9ff. for more information on the quantization error in the dco, see 8.5.4 quantization error in dco output . 8.4.2.2 modulo n divider the modulo n divider creates the low-frequency base clock (ibase) by dividing the internal clock (iclk) by the icg multiplier factor (n) contained in the icg multiplier register (icgmr). when n is programmed to a $01 or $00, the divider is disabled and iclk is passed through to ibase undivided. when the internal clock generator is stable, the frequency of ibase will be equal to the nominal frequency (f nom ) of 307.2 khz 25 percent. 8.4.2.3 frequency comparator the frequency comparator effectively compares the low-frequency base clock (ibase) to a nominal frequency, f nom . first, the frequency comparator converts ibase to a voltage by charging a known capacitor with a current reference for a period dependent on ibase. this voltage is compared to a voltage reference with comparators, whose outputs are fed to the digital loop filter. the dependence of these outputs on the capacitor size, current reference, and voltage reference causes up to 25 percent error in f nom .
internal clock generator module (icg) functional description MC68HC908RF2 ? rev. 1 advance information motorola internal clock generator module (icg) 115 8.4.2.4 digital loop filter the digital loop filter (dlf) uses the outputs of the frequency comparator to adjust the internal clock (iclk) clock period. the dlf generates the dco divider control bits (ddiv[3:0]) and the dco stage control bits (dstg[7:0]), which are fed to the dco. the dlf first concatenates the ddiv and dstg registers (ddiv[3:0]:dstg[7:0]) and then adds or subtracts a value dependent on the relative error in the low-frequency base clock ? s period, as shown in table 8-1 . in some extreme error conditions, such as operating at a v dd level which is out of specification, the dlf may attempt to use a value above the maximum ($9ff) or below the minimum ($000). in both cases, the value for ddiv will be between $a and $f. in this range, the ddiv value will be interpreted the same as $9 (the slowest condition). recovering from this condition requires subtracting (increasing frequency) in the normal fashion until the value is again below $9ff (if the desired value is $9xx, the value may settle at $axx through $fxx, an acceptable operating condition). if the error is less than 5 percent, the internal clock generator ? s filter stable indicator (ficgs) is set, indicating relative frequency accuracy to the clock monitor. table 8-1. correction sizes from dlf to dco frequency error of ibase compared to f nom ddvi[3:0]:dstg[7:0] correction current to new ddiv[3:0]:dstg[7:0] relative correction in dco ibase < 0.85 f nom ? 32 ( ? $020) min $xff to $xdf ? 2/31 ? 6.45% max $x20 to $x00 ? 2/19 ? 10.5% 0.85 f nom < ibase ibase < 0.95 f nom ? 8 ( ? $008) min $xff to $xf7 ? 0.5/31 ? 1.61% max $x08 to $x00 ? 0.5/17.5 ? 2.86% 0.95 f nom < ibase ibase < f nom ? 1 ( ? $001) min $xff to $xfe ? 0.0625/31 ? 0.202% max $x01 to $x00 ? 0.0625/17.0625 ? 0.366% f nom < ibase ibase < 1.05 f nom +1 (+$001) min $xfe to $xff +0.0625/30.9375 +0.202% max $x00 to $x01 +0.0625/17 +0.368% 1.05 f nom < ibase ibase < 1.15 f nom +8 (+$008) min $xf7 to $xff +0.5/30.5 +1.64% max $x00 to $x08 +0.5/17 +2.94% 1.15 f nom < ibase +32 (+$020) min $xdf to $xff +2/29 +6.90% max $x00 to $x20 +2/17 +11.8% x: maximum error is independent of value in ddiv[3:0]. ddiv increments or decrements when an addition to dstg[7:0] carries or borrows.
advance information MC68HC908RF2 ? rev. 1 116 internal clock generator module (icg) motorola internal clock generator module (icg) 8.4.3 external clock generator the icg also provides for an external oscillator or clock source, if desired. the external clock generator, shown in figure 8-3 , contains an external oscillator amplifier and an external clock input path. figure 8-3. external clock generator block diagram 8.4.3.1 external oscillator amplifier the external oscillator amplifier provides the gain required by an external crystal connected in a pierce oscillator configuration. the amount of this gain is controlled by the slow external (extslow) bit in the configuration register. when extslow is set, the amplifier gain is reduced for operating low-frequency crystals (32 khz to 100 khz). when extslow is clear, the amplifier gain will be sufficient for 1-mhz to 8-mhz crystals. extslow must be configured correctly for the given crystal or the circuit may not operate. c 1 c 2 r b x 1 r s * *r s can be 0 (shorted) when used eclk internal to mcu external components required for external crystal use only osc1 osc2 amplifier input path with higher-frequency crystals. refer to manufacturer ? s data. extslow external clock generator name name name name configuration register bit top level signal register bit module signal ecgon stop
internal clock generator module (icg) functional description MC68HC908RF2 ? rev. 1 advance information motorola internal clock generator module (icg) 117 the amplifier is enabled when the ecgon bit is set and stop mode is not enabled. when the amplifier is enabled, it will be connected between the osc1 and osc2 pins. in its typical configuration, the external oscillator requires five external components: 1. crystal, x 1 2. fixed capacitor, c 1 3. tuning capacitor, c 2 (can also be a fixed capacitor) 4. feedback resistor, r b 5. series resistor, r s (included in the diagram to follow strict pierce oscillator guidelines and may not be required for all ranges of operation, especially with high frequency crystals). refer to the crystal manufacturer ? s data for more information. 8.4.3.2 external clock input path the external clock input path is the means by which the microcontroller uses an external clock source. the input to the path is the osc1 pin and the output is the external clock (eclk). the path, which contains input buffering, is enabled when the ecgon bit is set and stop mode is not enabled. 8.4.4 clock monitor circuit the icg contains a clock monitor circuit which, when enabled, will continuously monitor both the external clock (eclk) and the internal clock (iclk) to determine if either clock source has failed based on these conditions:  either iclk or eclk has stopped.  the frequency of ibase < frequency eref divided by 4  the frequency of eclk < frequency of iref divided by 4 using the clock monitor requires both clocks to be active (ecgon and icgon are both set). to enable the clock monitor, both clocks must also be stable (ecgs and icgs both set). this is to prevent the use of the clock monitor when a clock is first turned on and potentially unstable
advance information MC68HC908RF2 ? rev. 1 118 internal clock generator module (icg) motorola internal clock generator module (icg) note: although the clock monitor can be enabled only when the both clocks are stable (icgs or ecgs is set), the clock monitor will remain enabled if one of the clocks goes unstable. the clock monitor only works if the external slow (extslow) bit in the configuration register is properly defined with respect to the external frequency source. the clock monitor circuit, shown in figure 8-4 , contains these blocks:  clock monitor reference generator  internal clock activity detector  external clock activity detector 8.4.4.1 clock monitor reference generator the clock monitor uses a reference based on one clock source to monitor the other clock source. the clock monitor reference generator generates the external reference clock (eref) based on the external clock (eclk) and the internal reference clock (iref) based on the internal clock (iclk). to simplify the circuit, the low-frequency base clock (ibase) is used in place of iclk because it always operates at or near 307.2 khz. for proper operation, eref must be at least twice as slow as ibase and iref must be at least twice as slow as eclk. to guarantee that iref is slower than eclk and eref is slower than ibase, one of the signals is divided down. which signal is divided and by how much is determined by the external slow (extslow) bit in the configuration register, according to the rules in table 8-2 . note that each signal (ibase and eclk) is always divided by four. a longer divider is used on either ibase or eclk based on the extslow bit. note: if extslow is not set according to the rules defined in table 8-2 , the clock monitor could switch clock sources unexpectedly.
internal clock generator module (icg) functional description MC68HC908RF2 ? rev. 1 advance information motorola internal clock generator module (icg) 119 figure 8-4. clock monitor block diagram ioff cmon ficgs ibase icgen eref ioff icgs ibase extxtalen extslow ecgs ecgon eclk icgon eref estbclk iref estbclk iref ecgen eclk cmon ecgs eoff iclk activity detector eclk activity detector divider cmon eoff ecgs icgs ibase icgen eclk name name name name configuration register bit top level signal register bit module signal ecgon stop extslow
advance information MC68HC908RF2 ? rev. 1 120 internal clock generator module (icg) motorola internal clock generator module (icg) the long divider (divide by 4096) is also used as an external crystal stabilization divider. the divider is reset when the external clock generator is off (ecgen is clear). when the external clock generator is first turned on, the external clock generator stable bit (ecgs) will be clear. this condition automatically selects eclk as the input to the long divider. the external stabilization clock (estbclk) will be eclk divided by 4096. this timeout allows the crystal to stabilize. the falling edge of estbclk is used to set ecgs. (ecgs will set after a full 16 or 4096 cycles.) when ecgs is set, the divider returns to its normal function. estbclk may be generated by either ibase or eclk, but any clocking will reinforce only the set condition. if ecgs is cleared because the clock monitor determined that eclk was inactive, the divider will revert to a stabilization divider. since this will change the eref and iref divide ratios, it is important to turn the clock monitor off (cmon = 0) after inactivity is detected to ensure valid recovery. table 8-2. clock monitor reference divider ratios icgon ecgon ecgs extslow external frequency eref divider ratio eref frequency estbclk divider ratio estbclk frequency iref divider ratio iref frequency 0xxx u u u u u off 0 x 0 0 x 0 off 0 off 0 u u xx0x min 30 khz off 0 4096 (eclk) 1.875 khz 1*4 76.8 khz 25% max 8 mhz 500 khz xx10 min 1 mhz 128*4 1.953 khz 4096 (eclk) 244 hz 1*4 76.8 khz 25% max 8 mhz 15.63 khz 1.953 khz xx11 min 30 khz 1*4 7.5 khz 4096 (ibase) 75 hz 25% 16*4 4.8 khz 25% max 100 khz 25.0 khz u: unaffected. refer to section of table where icgon or ecgon is set to x (don ? t care). ibase is always used as the internal frequency (307.2 khz).
internal clock generator module (icg) functional description MC68HC908RF2 ? rev. 1 advance information motorola internal clock generator module (icg) 121 8.4.4.2 internal clock activity detector the internal clock activity detector looks for at least one falling edge on the low-frequency base clock (ibase) every time the external reference (eref) is low. since eref is less than half the frequency of ibase, this should occur every time. if it does not occur two consecutive times, the internal clock inactivity indicator (ioff) is set. ioff will be cleared the next time there is a falling edge of ibase while eref is low. the internal clock stable bit (icgs) is set when ibase is within approximately 5 percent of the target 307.2 khz 25 percent for two consecutive measurements. icgs is cleared when ibase is outside the 5 percent of the target 307.2 khz 25 percent, the internal clock generator is disabled (icgen is clear), or when ioff is set. 8.4.4.3 external clock activity detector the external clock activity detector looks for at least one falling edge on the external clock (eclk) every time the internal reference (iref) is low. since iref is less than half the frequency of eclk, this should occur every time. if it does not occur two consecutive times, the external clock inactivity indicator (eoff) is set. eoff will be cleared the next time there is a falling edge of eclk while iref is low. the external clock stable bit (ecgs) is also generated in the external clock activity detector. ecgs is set on a falling edge of the external stabilization clock (estbclk). this will be 4096 eclk cycles after the external clock generator on bit (ecgon) is set. ecgs is cleared when the external clock generator is disabled (ecgon is clear) or when eoff is set.
advance information MC68HC908RF2 ? rev. 1 122 internal clock generator module (icg) motorola internal clock generator module (icg) 8.4.5 clock selection circuit the clock selection circuit, shown in figure 8-5 , contains two clock switches which generate the oscillator output clock (cgmxclk) from either the internal clock (iclk) or the external clock (eclk). the clock selection circuit also contains a divide-by-two circuit which creates the clock generator output clock (cgmout), which generates the bus clocks. figure 8-5. clock selection circuit block diagram 8.4.5.1 clock selection switch the clock select switch creates the oscillator output clock (cgmxclk) from either the internal clock (iclk) or the external clock (eclk), based on the clock select bit (cs; set selects eclk, clear selects iclk). when switching the cs bit, both iclk and eclk must be on (icgon and ecgon set). the clock being switched to must also be stable (icgs or ecgs set). iclk eclk ioff eoff force_i force_e select output synchronizing clock switcher div2 name name name top level signal register bit module signal reset eclk eoff iclk ioff v ss cs cgmout cgmxclk
internal clock generator module (icg) functional description MC68HC908RF2 ? rev. 1 advance information motorola internal clock generator module (icg) 123 8.4.5.2 clock switching circuit to robustly switch between the internal clock (iclk) and the external clock (eclk), the switch assumes the clocks are completely asynchronous, so a synchronizing circuit is required to make the transition (see figure 8-6 ). when the clock select bit is changed, the switch will continue to operate off the original clock for between 1 and 2 cycles as the select input transitions through one side of the synchronizer. next, the output will be held low for between 1 and 2 cycles of the new clock as the select input transitions through the other side. then the output starts switching at the new clock ? s frequency. this transition guarantees that no glitches will be seen on the output even though the select input may change asynchronously to the clocks. the unpredictably of the transition period is a necessary result of the asynchronicity. figure 8-6. synchronizing clock switcher circuit diagram force_i eclk eoff output dq ck dff qb select iclk dq ck dff qb dq ck dff qb dq ck dff qb force_e force_i = force internal; reset condition force_e = force external ioff
advance information MC68HC908RF2 ? rev. 1 124 internal clock generator module (icg) motorola internal clock generator module (icg) the switch automatically selects iclk during reset. when the clock monitor is on (cmon is set) and it determines one of the clock sources is inactive (as indicated by the ioff or eoff signals), the circuit is forced to select the active clock. there are no clocks for the inactive side of the synchronizer to properly operate, so that side is forced deselected. however, the active side will not be selected until one to two clock cycles after the ioff or eoff signal transitions. 8.5 usage notes the icg has several features which can provide protection to the microcontroller if properly used. there are other features which can greatly simplify usage of the icg if certain techniques are employed. this section will describe several possible ways to use the icg and its features. these techniques are not the only ways to use the icg, and may not be optimum for all environments. in any case, these techniques should be used only as a template, and the user should modify them according to the application ? s requirements. these notes include:  switching clock sources  enabling the clock monitor  using clock monitor interrupts  quantization error in dco output  switching internal clock frequencies  nominal frequency settling time  improving frequency settling time  trimming frequency
internal clock generator module (icg) usage notes MC68HC908RF2 ? rev. 1 advance information motorola internal clock generator module (icg) 125 8.5.1 switching clock sources switching from one clock source to another requires both clock sources to be enabled and stable. a simple flow requires: 1. enable desired clock source 2. wait for it to become stable 3. switch clocks 4. disable previous clock source the key point to remember in this flow is that the clock source cannot be switched (cs cannot be written) unless the desired clock is on and stable. a short assembly code example of how to employ this flow is shown in figure 8-7 . this code is for illustrative purposes only and does not represent valid syntax for any particular assembler. figure 8-7. code example for switching clock sources ;clock switching code example ;this code switches from internal to external clock ;clock monitor and interrupts are not enabled start lda #$13 ;mask for cs, ecgon, ecgs ;if switching from external to internal, mask is $0c. loop ** ** ;other code here, such as writing the cop, since ecgs may ;take some time to set sta icgcr ;try to set cs, ecgon and clear icgon. icgon will not ;clear until cs is set, and cs will not set until ;ecgon and ecgs are set. cmpa icgcr ;check to see if ecgs set, then cs set, then icgon clear bne loop ;keep looping until icgon is clear.
advance information MC68HC908RF2 ? rev. 1 126 internal clock generator module (icg) motorola internal clock generator module (icg) 8.5.2 enabling the clock monitor many applications require the clock monitor to determine if one of the clock sources has become inactive, so the other can be used to recover from a potentially dangerous situation. using the clock monitor requires both clocks to be active (ecgon and icgon both set). to enable the clock monitor, both clocks also must be stable (ecgs and icgs both set). this is to prevent the use of the clock monitor when a clock is first turned on and potentially unstable. enabling the clock monitor and clock monitor interrupts requires a flow similar to this flow: 1. enable the alternate clock source 2. wait for both clock sources to be stable 3. switch to the desired clock source if necessary 4. enable the clock monitor 5. enable clock monitor interrupts these events must happen in sequence. a short assembly code example of how to employ this flow is shown in figure 8-8 . this code is for illustrative purposes only and does not represent valid syntax for any particular assembler. figure 8-8. code example for enabling the clock monitor ;clock monitor enabling code example ;this code turns on both clocks, selects the desired ; one, then turns on the clock monitor and interrupts start lda #$af ;mask for cmie, cmon, icgon, icgs, ecgon, ecgs ; if internal clock desired, mask is $af ; if external clock desired, mask is $bf ; if interrupts not desired mask is $2f int; $3f ext loop ** ** ;other code here, such as writing the cop, since ecgs ; and icgs may take some time to set. sta icgcr ;try to set cmie. cmie wont set until cmon set; cmon ; won ? t set until icgon, icgs, ecgon, ecgs set. brset 6,icgcr,error ;verify cmf is not set cmpa icgcr ;check if ecgs set, then cmon set, then cmie set bne loop ;keep looping until cmie is set.
internal clock generator module (icg) usage notes MC68HC908RF2 ? rev. 1 advance information motorola internal clock generator module (icg) 127 8.5.3 clock monitor interrupts the clock monitor circuit can be used to recover from perilous situations such as crystal loss. to use the clock monitor effectively, these notes should be observed:  enable the clock monitor and clock monitor interrupts.  the first statement in the clock monitor interrupt service routine should be a read to the icg control register (icgcr) to verify that the clock monitor flag (cmf) is set. this is also the first step in clearing the cmf bit.  never use bset or bclr instructions on the icgcr, as this may inadvertently clear cmf. only use the brset and brclr instructions to check the cmf bit and not to check any other bits in the icgcr.  when the clock monitor detects inactivity on the selected clock source (defined by the cs bit of the icg control register), the inactive clock is deselected automatically and the remaining active clock is selected as the source for cgmxclk. the interrupt service routine can use the state of the cs bit to check which clock is inactive.  when the clock monitor detects inactivity, the application may have been subjected to extreme conditions which may have affected other circuits. the clock monitor interrupt service routine should take any appropriate precautions. 8.5.4 quantization error in dco output the digitally controlled oscillator (dco) is comprised of three major sub- blocks: 1. binary weighted divider 2. variable-delay ring oscillator 3. ring oscillator fine-adjust circuit each of these blocks affects the clock period of the internal clock (iclk). since these blocks are controlled by the digital loop filter (dlf) outputs
advance information MC68HC908RF2 ? rev. 1 128 internal clock generator module (icg) motorola internal clock generator module (icg) ddiv and dstg, the output of the dco can change only in quantized steps as the dlf increments or decrements its output. the following sections describe how each block will affect the output frequency. 8.5.4.1 digitally controlled oscillator the digitally controlled oscillator (dco) is an inaccurate oscillator which generates the internal clock (iclk), whose clock period is dependent on the digital loop filter outputs (dstg[7:0] and ddiv[3:0]). because of the digital nature of the dco, the clock period of iclk will change in quantized steps. this will create a clock period difference or quantization error (q-err) from one cycle to the next. over several cycles or for longer periods, this error is divided out until it reaches a minimum error of 0.202 percent to 0.368 percent. the dependence of this error on the ddiv[3:0] value and the number of cycles the error is measured over is shown in table 8-3 . 8.5.4.2 binary weighted divider the binary weighted divider divides the output of the ring oscillator by a power of 2, specified by the dco divider control bits (ddiv[3:0]). ddiv maximizes at %1001 (values of %1010 through %1111 are interpreted as %1001), which corresponds to a divide by 512. when ddiv is %0000, table 8-3. quantization error in iclk ddiv[3:0] iclk cycles bus cycles t iclk q-err %0000 (min) 4 1 1.61% ? 2.94% %0000 (min) 32 8 0.202% ? 0.368% %0001 4 1 0.806% ? 1.47% %0001 16 4 0.202% ? 0.368% %0010 4 1 0.403% ? 0.735% %0010 8 2 0.202% ? 0.368% %0011 4 1 0.202% ? 0.368% %0100 2 1 0.202% ? 0.368% %0101 ? %1001 (max) 1 1 0.202% ? 0.368%
internal clock generator module (icg) usage notes MC68HC908RF2 ? rev. 1 advance information motorola internal clock generator module (icg) 129 the ring oscillator ? s output is divided by 1. incrementing ddiv by 1 will double the period; decrementing ddiv will halve the period. the dlf cannot directly increment or decrement ddiv; ddiv is only incremented or decremented when an addition or subtraction to dstg carries or borrows. 8.5.4.3 variable-delay ring oscillator the variable-delay ring oscillator ? s period is adjustable from 17 to 31 stage delays, in increments of two, based on the upper three dco stage control bits (dstg[7:5]). a dstg[7:5] of %000 corresponds to 17 stage delays; dstg[7:5] of %111 corresponds to 31 stage delays. adjusting the dstg[5] bit has a 6.45 percent to 11.8 percent effect on the output frequency. this also corresponds to the size correction made when the frequency error is greater than 15 percent. the value of the binary weighted divider does not affect the relative change in output clock period for a given change in dstg[7:5]. 8.5.4.4 ring oscillator fine-adjust circuit the ring oscillator fine-adjust circuit causes the ring oscillator to effectively operate at non-integer numbers of stage delays by operating at two different points for a variable number of cycles specified by the lower five dco stage control bits (dstg[4:0]). for example, when dstg[7:5] is %011, the ring oscillator nominally operates at 23 stage delays. when dstg[4:0] is %00000, the ring will always operate at 23 stage delays. when dstg[4:0] is %00001, the ring will operate at 25 stage delays for one of 32 cycles and at 23 stage delays for 31 of 32 cycles. likewise, when dstg[4:0] is %11111, the ring operates at 25 stage delays for 31 of 32 cycles and at 23 stage delays for one of 32 cycles. when dstg[7:5] is %111, similar results are achieved by including a variable divide-by-two, so the ring operates at 31 stages for some cycles and at 17 stage delays, with a divide-by-two for an effective 34 stage delays, for the remainder of the cycles. adjusting the dstg[0] bit has a 0.202 percent to 0.368 percent effect on the output clock period. this corresponds to the minimum size correction made by the dlf, and the inherent, long-term quantization error in the output frequency.
advance information MC68HC908RF2 ? rev. 1 130 internal clock generator module (icg) motorola internal clock generator module (icg) 8.5.5 switching internal clock frequencies the frequency of the internal clock (iclk) may need to be changed for some applications. for example, if the reset condition does not provide the correct frequency, or if the clock is slowed down for a low-power mode (or sped up after a low-power mode), the frequency must be changed by programming the internal clock multiplier factor (n). the frequency of iclk is n times the frequency of ibase, which is 307.2 khz 25 percent. before switching frequencies by changing the n value, the clock monitor must be disabled. this is because when n is changed, the frequency of the low-frequency base clock (ibase) will change proportionally until the digital loop filter has corrected the error. since the clock monitor uses ibase, it could erroneously detect an inactive clock. the clock monitor cannot be re-enabled until the internal clock is stable again (icgs is set). note: there is no hardware mechanism to prevent changing bus frequency dynamically. be careful when changing bus frequency and consider the impact on the system. this flow is an example of how to change the clock frequency: 1. verify there is no clock monitor interrupt by reading the cmf bit. 2. turn off the clock monitor. 3. if desired, switch to the external clock (see 8.5.1 switching clock sources ). 4. change the value of n. 5. switch back to internal (see 8.5.1 switching clock sources ), if desired. 6. turn on the clock monitor (see 8.5.2 enabling the clock monitor ), if desired.
internal clock generator module (icg) usage notes MC68HC908RF2 ? rev. 1 advance information motorola internal clock generator module (icg) 131 8.5.6 nominal frequency settling time because the clock period of the internal clock (iclk) is dependent on the digital loop filter outputs (ddiv and dstg) which cannot change instantaneously, iclk will temporarily operate at an incorrect clock period when any of the operating condition changes. this happens whenever the part is reset, the icg multiply factor (n) is changed, the icg trim factor (trim) is changed, or the internal clock is enabled after inactivity (stop or disabled operation). the time that the iclk takes to adjust to the correct period is known as the settling time. settling time depends primarily on how many corrections it takes to change the clock period, and the period of each correction. since the corrections require four periods of the low-frequency base clock (4*t ibase ), and since iclk is n (the icg multiply factor for the desired frequency) times faster than ibase, each correction takes 4*n*t iclk . the period of iclk, however, will vary as the corrections occur. 8.5.6.1 settling to within 15 percent when the error is greater than 15 percent, the filter takes eight corrections to double or halve the clock period. due to how the dco increases or decreases the clock period, the total period of these eight corrections is approximately 11 times the period of the fastest correction. (if the corrections were perfectly linear, the total period would be 11.5 times the minimum period; however, the ring must be slightly non-linear.) therefore, the total time it takes to double or halve the clock period is 44*n*t iclkfast . if the clock period needs more than doubled or halved, the same relationship applies, only for each time the clock period needs doubled, the total number of cycles doubles. that is, when transitioning from fast to slow:  going from the initial speed to half speed takes 44*n*t iclkfast  from half speed to quarter speed takes 88*n*t iclkfast  going from quarter speed to eighth speed takes 176*n*t iclkfast , and so on.
advance information MC68HC908RF2 ? rev. 1 132 internal clock generator module (icg) motorola internal clock generator module (icg) this series can be expressed as (2 x ? 1)*44*n*t iclkfast , where x is the number of times the speed needs doubled or halved. since 2 x happens to be equal to t iclkslow /t iclkfast , the equation reduces to 44*n*(t iclkslow -t iclkfast ). note that increasing speed takes much longer than decreasing speed since n is higher. this can be expressed in terms of the initial clock period (t 1 ) minus the final clock period (t 2 ) as such: 8.5.6.2 settling to within 5 percent once the clock period is within 15 percent of the desired clock period, the filter starts making smaller adjustments. when between 15 percent and 5 percent error, each correction will adjust the clock period between 1.61 percent and 2.94 percent. in this mode, a maximum of eight corrections will be required to get to less than 5 percent error. since the clock period is relatively close to desired, each correction takes approximately the same period of time, or 4*t ibase . at this point, the internal clock stable bit (icgs) will be set and the clock frequency is usable, although the error will be as high as 5 percent. the total time to this point is: 8.5.6.3 total settling time once the clock period is within 5 percent of the desired clock period, the filter starts making minimum adjustments. in this mode, each correction will adjust the frequency between 0.202 percent and 0.368 percent. a maximum of 24 corrections will be required to get to the minimum error. each correction takes approximately the same period of time or 4*t ibase . added to the corrections for 15 percent to 5 percent, this makes 32 corrections (128*t ibase ) to get from 15 percent to the minimum error. the total time to the minimum error is: t 15 abs 44n t 1 t 2 ? () [] = t 5 abs 44n t 1 t 2 ? () [] 32t ibase + = t tot abs 44n t 1 t 2 ? () [] 128t ibase + =
internal clock generator module (icg) usage notes MC68HC908RF2 ? rev. 1 advance information motorola internal clock generator module (icg) 133 the equations for t 15 , t 5 , and t tot are dependent on the actual initial and final clock periods t 1 and t 2 , not the nominal. this means the variability in the iclk frequency due to process, temperature, and voltage must be considered. additionally, other process factors and noise can affect the actual tolerances of the points at which the filter changes modes. this means a worst case adjustment of up to 35 percent (iclk clock period tolerance plus 10 percent) must be added. this adjustment can be reduced with trimming. table 8-4 shows some typical values for settling time. 8.5.7 improving settling time the settling time of the internal clock generator can be vastly improved if an external clock source can be used during the settling time. when the internal clock generator is disabled (icgon is low), the ddiv[3:0] and dstg[7:0] bits can be written. then, when the internal clock generator is re-enabled, the clock period will automatically start at the point written in the ddiv and dstg bits. since a change in the ddiv and dstg bits only cause a change in the clock period relative to the starting point, the starting point must first be captured. the initial clock period can be expressed as in the next example, where t x is a process, temperature, and voltage dependent constant and ddiv1 and dstg1 are the values of ddiv and dstg when operating at t 1 . table 8-4. typical settling time examples t 1 t 2 n t 15 t 5 t tot 1/ (6.45 mhz) 1/ (25.8 mhz) 84 430 s535 s 850 s 1/ (25.8 mhz) 1/ (6.45 mhz) 21 107 s212 s 525 s 1/ (25.8 mhz) 1/ (307.2 khz) 1 141 s246 s 560 s 1/ (307.2 khz) 1/ (25.8 mhz) 84 11.9 ms 12.0 ms 12.3 ms t 1 t x 2 ddiv1 dstg1 ?? =
advance information MC68HC908RF2 ? rev. 1 134 internal clock generator module (icg) motorola internal clock generator module (icg) finding the new values for ddiv and dstg is easy if the new clock period is a binary multiple or fraction of the original. in this case, dstg is unchanged and ddiv2 is ddiv1 + log 2 (t 2 /t 1 ). if the new clock period is not a binary multiple or fraction of the original, both dstg and ddiv may need to change according to these equations: if dstg2 is greater than 255: the software required to do this is relatively simple, since most of the math can be done before coding because the initial and final clock periods are known. an example of how to code this in assembly code is shown in figure 8-9 . this example is for illustrative purposes only and does not represent a valid syntax for any particular assembler. dvfact int t 2 t 1 ? () log 2 () log --------------------------- = ddiv2 ddiv1 dvfact + = dsfact t 2 t 1 ? () 2 ddiv2 ddiv1 ? () ---------------------------------------------------- = dstg2 dsfact dstg1 ? = ddiv2 ddiv2 1 + = dstg2 dstg2 2 -------------------- - =
internal clock generator module (icg) usage notes MC68HC908RF2 ? rev. 1 advance information motorola internal clock generator module (icg) 135 figure 8-9. code example for writing ddiv and dstg 8.5.8 trimming frequency on the internal clock generator the unadjusted frequency of the low-frequency base clock (ibase), when the comparators in the frequency comparator indicate zero error, will vary as much as 25 percent due to process, temperature, and voltage dependencies. these dependencies are in the voltage and current references, the offset of the comparators, and the internal capacitor. the voltage and temperature dependencies have been designed to be a maximum of approximately 1 percent error. the process dependencies account for the rest. ;ddiv and dstg modification code example ;changes ddiv and dstg according to the initial and ; desired clock period values ;requires icgon to be clear (disabled) ;user must previously calculate dvfact and stfact by ; the equations listed in the specification ;modifies x and a registers start lda icgcr ;verify icgon clear (this will require cmp #13 ; cmie,cmf,cmon,icgon,icgs clear and cs,ecgon,ecgs set) lda #dvfact ;add the ddiv factor (calculated before add icgdvr ; coding by the ddiv2 equation) sta icgdvr lda #stfact ;load the dstg factor (calculated before coding and ; multiplied by 128 to make it 0-255 for maximum precision ldx icgdsr ;load current stage register contents mul ;multiply factor times current value rola ;since factor was multiplied by 128, rolx ; result is x6-x0:a7, so put it all in x bcc store ;if result is >255, rolx will set carry rorx ; so divide result by two and inc ; add one to ddiv store stx icgdsr ;store value lda icgdvr ;test to see if ddiv too high or low cmp #09 ;valid range 0-9; too low is ff/fe; too high is 0a/0b bhi exit ;if ddiv is 0-9, you ? re almost done lda #09 ;otherwise, maximize period and execute error code sta icgdvr jmp error exit jmp enable ;jump to code which turns on desired ;clock, clock monitor, interrupts, etc.
advance information MC68HC908RF2 ? rev. 1 136 internal clock generator module (icg) motorola internal clock generator module (icg) fortunately, for an individual part, the process dependencies are constant. an individual part can operate at approximately 2 percent variance from its unadjusted operating point over the entire specification range of the application. if the unadjusted operating point can be changed, the entire variance can be limited to 2 percent. the method of changing the unadjusted operating point is by changing the size of the capacitor. this capacitor is designed with 639 equally sized units, 384 of which are always connected. the remaining 255 units are put in by adjusting the icg trim factor (trim). the default value for trim is $80, or 128 units, making the default capacitor size 512. each unit added or removed will adjust the output frequency by about 0.195 percent of the unadjusted frequency (adding to trim will decrease frequency). therefore, the frequency of ibase can be changed to 25 percent of its unadjusted value, which is enough to cancel the process variability mentioned before. the best way to trim the internal clock is to use the timer to measure the width of an input pulse on an input capture pin (this pulse must be supplied by the application and should be as long or wide as possible). considering the prescale value of the timer and the theoretical (zero error) frequency of the bus (307.2 khz *n/4), the error can be calculated. this error, expressed as a percentage, can be divided by 0.195 percent and the resultant factor added or subtracted from trim. this process should be repeated to eliminate any residual error. note: it is recommended that the user preserve a copy of the contents of the icg trim register (icgtr) in non-volitale memory. address $7fef is reserved for an optional factory-determined value. consult with a local motorola representative for more information and availability of this option.
internal clock generator module (icg) low-power modes MC68HC908RF2 ? rev. 1 advance information motorola internal clock generator module (icg) 137 8.6 low-power modes the wait and stop instructions put the mcu in low power- consumption standby modes. 8.6.1 wait mode the icg remains active in wait mode. if enabled, the icg interrupt to the cpu can bring the mcu out of wait mode. in some applications, low-power consumption is desired in wait mode and a high-frequency clock is not needed. in these applications, reduce power consumption by either selecting a low-frequency external clock and turning the internal clock generator off, or reducing the bus frequency by minimizing the icg multiplier factor (n) before executing the wait instruction. 8.6.2 stop mode the icg is disabled in stop mode. upon execution of the stop instruction, all icg activity will cease and the output clocks (cgmxclk and cgmout) will be held low. power consumption will be minimal. the stop instruction does not affect the values in the icg registers. normal execution will resume after the mcu exits stop mode. 8.7 configuration register option one configuration register option affects the functionality of the icg: extslow (slow external clock). all configuration register options will have a default setting. refer to section 9. configuration register (config) on how the configuration register is used.
advance information MC68HC908RF2 ? rev. 1 138 internal clock generator module (icg) motorola internal clock generator module (icg) 8.7.1 extslow slow external clock (extslow), when set, will decrease the drive strength of the oscillator amplifier, enabling low-frequency crystal operation (30 khz ? 100 khz). when clear, extslow enables high frequency crystal operation (1 mhz to 8 mhz). extslow, when set, also configures the clock monitor to expect an external clock source that is slower than the low-frequency base clock (60 hz ? 307.2 khz). when extslow is clear, the clock monitor will expect an external clock faster than the low-frequency base clock (307.2 khz ? 32 mhz). the default state for this option is clear. 8.8 i/o registers the icg contains five registers, summarized in figure 8-10 . these registers are:  icg control register, icgcr  icg multiplier register, icgmr  icg trim register, icgtr  icg dco divider control register, icgdvr  icg dco stage control register, icgdsr several of the bits in these registers have interaction where the state of one bit may force another bit to a particular state or prevent another bit from being set or cleared. a summary of this interaction is shown in table 8-5 .
internal clock generator module (icg) i/o registers MC68HC908RF2 ? rev. 1 advance information motorola internal clock generator module (icg) 139 addr.register name bit 7654321bit 0 $0036 internal clock generator control register (icgcr) see page 141. read: cmie cmf cmon cs icgon icgs ecgon ecgs write: reset:00001000 $0037 internal clock generator multiplier register (icgmr) see page 143. read: r n6n5n4n3n2n1n0 write: reset:00010101 $0038 internal clock generator trim register (icgtr) see page 144. read: trim7 trim6 trim5 trim4 trim3 trim2 trim1 trim0 write: reset:10000000 $0039 i cg dco divider control register (icgdvr) see page 145. read: rrrrddiv3ddiv2ddiv1ddiv0 write: reset:0 0 0 0uuuu $003a icg dco stage register (icgdsr) see page 146. read: dstg7 dstg6 dstg5 dstg4 dstg3 dstg2 dstg1 dstg0 write: reset: unaffected by reset = unimplemented r = reserved u = unaffected figure 8-10. icg i/o register summary
advance information MC68HC908RF2 ? rev. 1 140 internal clock generator module (icg) motorola internal clock generator module (icg) table 8-5. icg module register bit interaction summary condition register bit results for given condition cmie cmf cmon cs icgon icgs ecgon ecgs n[6:0] trim[7:0] ddiv[3:0] dstg[7:0] reset00001000$15$80 ?? cmf = 1 ? (1) 1 ? 1 ? 1 ? uw uw uw uw cmon = 0 0 0 (0) ????????? cmon = 1 ?? (1) ? 1 ? 1 ? uw uw uw uw cs = 0 ??? (0) 1 ????? uw uw cs = 1 ??? (1) ?? 1 ????? icgon = 00001(0)01 ????? icgon = 1 ???? (1) ????? uw uw icgs = 0 us ? us uc ? (0) ?????? ecgon = 000001 ? (0) 0 ?? uw uw ecgs = 0 us ? us us ??? (0) ???? ioff = 1 ? 1* (1) 1 (1) 0 (1) ? uw uw uw uw eoff = 1 ? 1* (1) 0 (1) ? (1) 0 uw uw uw uw n = written (0) (0) (0) ?? 0* ?????? trim = written (0) (0) (0) ?? 0* ?????? ? register bit is unaffected by the given condition. 0, 1 register bit is forced clear or set, respectively, in the given condition. 0*, 1* register bit is temporarily forced clear or set, respectively, in the given condition. (0), (1) register bit must be clear or set, respectively, for the given condition to occur. us, uc, uw register bit cannot be set, cleared, or written, respectively, in the given condition.
internal clock generator module (icg) i/o registers MC68HC908RF2 ? rev. 1 advance information motorola internal clock generator module (icg) 141 8.8.1 icg control register the icg control register (icgcr) contains the control and status bits for the internal clock generator, external clock generator, and clock monitor as well as the clock select and interrupt enable bits. cmie ? clock monitor interrupt enable bit this read/write bit enables clock monitor interrupts. an interrupt will occur when both cmie and cmf are set. cmie can be set when the cmon bit has been set for at least one cycle. cmie is forced clear when cmon is clear or during reset. 1 = clock monitor interrupts enabled 0 = clock monitor interrupts disabled cmf ? clock monitor interrupt flag this read-only bit is set when the clock monitor determines that either iclk or eclk becomes inactive and the cmon bit is set. this bit is cleared by first reading the bit while it is set, followed by writing the bit low. this bit is forced clear when cmon is clear or during reset. 1 = either iclk or eclk has become inactive. 0 = iclk and eclk have not become inactive since the last read of the icgcr or the clock monitor is disabled. cmon ? clock monitor on bit this read/write bit enables the clock monitor. cmon can be set when both iclk and eclk have been on and stable for at least one bus cycle (icgon, ecgon, icgs, and ecgs are all set). cmon is address: $0036 bit 7654321bit 0 read: cmie cmf cmon cs icgon icgs ecgon ecgs write: reset:00001000 = unimplemented figure 8-11. icg control register (icgcr)
advance information MC68HC908RF2 ? rev. 1 142 internal clock generator module (icg) motorola internal clock generator module (icg) forced set when cmf is set, to avoid inadvertent clearing of cmf. cmon is forced clear when either icgon or ecgon is clear or during reset. 1 = clock monitor output enabled 0 = clock monitor output disabled cs ? clock select bit this read/write bit determines which clock will generate the oscillator output clock (cgmxclk). this bit can be set when ecgon and ecgs have been set for at least one bus cycle and can be cleared when icgon and icgs have been set for at least one bus cycle. this bit is forced set when the clock monitor determines the internal clock (iclk) is inactive or when icgon is clear. this bit is forced clear when the clock monitor determines that the external clock (eclk) is inactive, when ecgon is clear, or during reset. 1 = external clock (eclk) sources cgmxclk 0 = internal clock (iclk) sources cgmxclk icgon ? internal clock generator on bit this read/write bit enables the internal clock generator. icgon can be cleared when the cs bit has been set and the cmon bit has been clear for at least one bus cycle. icgon is forced set when the cmon bit is set, the cs bit is clear, or during reset. 1 = internal clock generator enabled 0 = internal clock generator disabled icgs ? internal clock generator stable bit this read-only bit indicates when the internal clock generator has determined that the internal clock (iclk) is within about 5 percent of the desired value. this bit is forced clear when the clock monitor determines the iclk is inactive, when icgon is clear, when the icg multiplier factor is written, or during reset. 1 = internal clock is within 5 percent of the desired value. 0 = internal clock may not be within 5 percent of the desired value.
internal clock generator module (icg) i/o registers MC68HC908RF2 ? rev. 1 advance information motorola internal clock generator module (icg) 143 ecgon ? external clock generator on bit this read/write bit enables the external clock generator. ecgon can be cleared when the cs and cmon bits have been clear for at least one bus cycle. ecgon is forced set when the cmon bit or the cs bit is set. ecgon is forced clear during reset. 1 = external clock generator enabled 0 = external clock generator disabled ecgs ? external clock generator stable bit this read-only bit indicates when at least 4096 external clock (eclk) cycles have elapsed since the external clock generator was enabled. this is not an assurance of the stability of eclk but is meant to provide a startup delay. this bit is forced clear when the clock monitor determines eclk is inactive, when ecgon is clear, or during reset. 1 = 4096 eclk cycles have elapsed since ecgon was set. 0 = external cock is unstable, inactive, or disabled. 8.8.2 icg multiplier register n6 ? n0 ? icg multiplier factor bits these read/write bits change the multiplier used by the internal clock generator. the internal clock (iclk) will be (307.2 khz 25 percent) * n. a value of $00 in this register is interpreted the same as a value of $01. this register cannot be written when the cmon bit is set. reset sets this factor to $15 (decimal 21) for default frequency of 6.45 mhz 25 percent (1.613 mhz 25 percent bus). address: $0037 bit 7654321bit 0 read: r n6n5n4n3n2n1n0 write: reset:00010101 r= reserved figure 8-12. icg multiplier register (icgmr)
advance information MC68HC908RF2 ? rev. 1 144 internal clock generator module (icg) motorola internal clock generator module (icg) 8.8.3 icg trim register trim7 ? trim0 ? icg trim factor bits these read/write bits change the size of the internal capacitor used by the internal clock generator. by testing the frequency of the internal clock and incrementing or decrementing this factor accordingly, the accuracy of the internal clock can be improved to 2 percent. incrementing this register by 1 decreases the frequency by 0.195 percent of the unadjusted value. decrementing this register by one increases the frequency by 0.195 percent. this register cannot be written when the cmon bit is set. reset sets these bits to $80, centering the range of possible adjustment. note: it is recommended that the user preserve a copy of the contents of the icg trim register (icgtr) in non-volitale memory. address $7fef is reserved for an optional factory-determined icg trim value. consult with a local motorola representative for more information and availability of this option. address: $0038 bit 7654321bit 0 read: trim7 trim6 trim5 trim4 trim3 trim2 trim1 trim0 write: reset:10000000 figure 8-13. icg trim register (icgtr)
internal clock generator module (icg) i/o registers MC68HC908RF2 ? rev. 1 advance information motorola internal clock generator module (icg) 145 8.8.4 icg dco divider register ddiv3 ? ddiv0 ? icg dco divider control bits these bits indicate the number of divide-by-twos (ddiv) that follow the digitally controlled oscillator. incrementing ddiv will add another divide-by-two, doubling the period (halving the frequency). decrementing has the opposite effect. ddiv cannot be written when icgon is set to prevent inadvertent frequency shifting. when icgon is set, ddiv is controlled by the digital loop filter. the range of valid values for ddiv is from $0 to $9. values of $a ? $f are interpreted the same as $9. since the dco is active during reset, reset has no effect on dstg and the value may vary. address: $0039 bit 7654321bit 0 read: r r r r ddiv3 ddiv2 ddiv1 ddiv0 write: reset:0000uuuu r = reserved u = unaffected figure 8-14. icg dco divider register (icgdvr)
advance information MC68HC908RF2 ? rev. 1 146 internal clock generator module (icg) motorola internal clock generator module (icg) 8.8.5 icg dco stage register dstg7 ? dstg0 ? icg dco stage control bits these bits indicate the number of stages dstg (above the minimum) in the digitally controlled oscillator. the total number of stages is approximately equal to $1ff, so changing dstg from $00 to $ff will approximately double the period. incrementing dstg will increase the period (decrease the frequency) by 0.202 percent to 0.368 percent (decrementing has the opposite effect). dstg cannot be written when icgon is set to prevent inadvertent frequency shifting. when icgon is set, dstg is controlled by the digital loop filter. since the dco is active during reset, reset has no effect on dstg and the value may vary. address: $003a bit 7654321bit 0 read: dstg7 dstg6 dstg5 dstg4 dstg3 dstg2 dstg1 dstg0 write: reset: unaffected by reset figure 8-15. icg dco stage register (icgdsr)
MC68HC908RF2 ? rev. 1 advance information motorola configuration register (config) 147 advance information ? MC68HC908RF2 section 9. configuration register (config) 9.1 contents 9.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .147 9.3 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .147 9.2 introduction this section describes the configuration register (config). the configuration register enables or disables these options:  stop mode recovery time (32 cgmxclk cycles or 4,096 cgmxclk cycles)  cop timeout period (2 18 ? 2 4 or 2 13 ? 2 4 cgmxclk cycles)  stop instruction  computer operating properly module (cop)  low-voltage inhibit (lvi) module control 9.3 functional description the config register is used in the initialization of various options and can be written once after each reset. the register is set to the documented value during reset. since the various options affect the operation of the mcu, it is recommended that these registers be written immediately after reset. the configuration register is located at $001f. note: on a flash device, the options are one-time writable by the user after each reset. the config register is not in the flash memory but is a special register containing one-time writable latches after each reset.
advance information MC68HC908RF2 ? rev. 1 148 configuration register (config) motorola configuration register (config) upon a reset, the config register defaults to predetermined settings as shown in figure 2-1. memory map . extslow ? slow external crystal enable bit the extslow bit has two functions. it configures the icg module for a fast (1 mhz ? 8 mhz) or slow (30 khz ? 100 khz) speed crystal. the option also configures the clock monitor operation in the icg module to expect an external frequency higher (307.2 khz ? 32 mhz) or lower (60 hz ? 307.2 khz) than the base frequency of the internal oscillator. (see section 8. internal clock generator module (icg) .) 1 = icg set for slow external crystal operation 0 = icg set for fast external crystal operation lvistop ? lvi enable in stop mode bit when the lvipwr bit is set, setting the lvistop bit enables the lvi to operate during stop mode. reset clears lvistop. 1 = lvi enabled during stop mode 0 = lvi disabled during stop mode lvirst ? lvi reset enable bit lvirst enables the reset signal from the lvi module. (see section 12. low-voltage inhibit (lvi) .) 1 = lvi module resets enabled 0 = lvi module resets disabled lvipwr ? lvi power enable bit lvipwr disables the lvi module. (see section 12. low-voltage inhibit (lvi) .) 1 = lvi module power enabled 0 = lvi module power disabled address: $001f bit 7654321bit 0 read: extslow lvistop lvirst lvipwr coprs ssrec stop copd write: reset:00110000 figure 9-1. configuration register (config)
configuration register (config) functional description MC68HC908RF2 ? rev. 1 advance information motorola configuration register (config) 149 coprs ? cop rate select bit coprs selects the cop timeout period. reset clears coprs. (see section 11. computer operating properly module (cop) .) 1 = cop timeout period = 2 13 ? 2 4 cgmxclk cycles 0 = cop timeout period = 2 18 ? 2 4 cgmxclk cycles ssrec ? short stop recovery bit ssrec enables the cpu to exit stop mode with a delay of 32 cgmxclk cycles instead of a 4096-cgmxclk cycle delay. 1 = stop mode recovery after 32 cgmxclk cycles 0 = stop mode recovery after 4096 cgmxclk cycles note: exiting stop mode by pulling reset will result in the long stop recovery. if using the internal clock generator module or an external crystal oscillator, do not set the ssrec bit. the lvi has an enable time of t en . the system stabilization time for power-on reset and long stop recovery (both 4096 cgmxclk cycles) gives a delay longer than the lvi enable time for these startup scenarios. there is no period where the mcu is not protected from a low-power condition. however, when using the short stop recovery configuration option, the 32 cgmxclk delay must be greater than the lvi ? s turn on time to avoid a period in startup where the lvi is not protecting the mcu. stop ? stop instruction enable bit stop enables the stop instruction. 1 = stop instruction enabled 0 = stop instruction treated as illegal opcode copd ? cop disable bit copd disables the cop module. (see section 11. computer operating properly module (cop) .) 1 = cop module disabled 0 = cop module enabled
advance information MC68HC908RF2 ? rev. 1 150 configuration register (config) motorola configuration register (config)
MC68HC908RF2 ? rev. 1 advance information motorola monitor read-only memory (mon) 151 advance information ? MC68HC908RF2 section 10. monitor read-only memory (mon) 10.1 contents 10.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .151 10.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .152 10.4 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .152 10.4.1 monitor mode entry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .154 10.4.2 data format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .155 10.4.3 echoing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .156 10.4.4 break signal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .156 10.4.5 commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .157 10.4.6 baud rate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .160 10.4.7 security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .160 10.2 introduction this section describes the monitor read-only memory (mon). the mon allows complete testing of the mcu through a single-wire interface with a host computer.
advance information MC68HC908RF2 ? rev. 1 152 monitor read-only memory (mon) motorola monitor read-only memory (mon) 10.3 features features of the monitor rom include:  normal user-mode pin functionality  one pin dedicated to serial communication between monitor rom and host computer  standard mark/space non-return-to-zero (nrz) communication with host computer  9600 baud communication with host computer when using a 9.8304-mhz crystal  execution of code in random-access memory (ram) or flash  flash security  flash programming 10.4 functional description monitor rom receives and executes commands from a host computer. figure 10-1 shows a sample circuit used to enter monitor mode and communicate with a host computer via a standard rs-232 interface. while simple monitor commands can access any memory address, the MC68HC908RF2 has a flash security feature to prevent external viewing of the contents of flash. proper procedures must be followed to verify flash content. access to the flash is denied to unauthorized users of customer-specified software (see 10.4.7 security ). in monitor mode, the mcu can execute host-computer code in ram while all mcu pins except pta0 retain normal operating mode functions. all communication between the host computer and the mcu is through the pta0 pin. a level-shifting and multiplexing interface is required between pta0 and the host computer. pta0 is used in a wired-or configuration and requires a pullup resistor.
monitor read-only memory (mon) functional description MC68HC908RF2 ? rev. 1 advance information motorola monitor read-only memory (mon) 153 figure 10-1. monitor mode circuit + + + 10 m ? x1 v dd v hi mc145407 mc74hc125 68hc908rk2 rst irq1 osc1 osc2 v ss v dd pta0 v dd 10 k ? 0.1 f 10 k ? 6 5 2 4 3 1 db-25 2 3 7 20 18 17 19 16 15 v dd v dd v dd 20 pf 20 pf 10 f 10 f 10 f 10 f 1 2 4 7 14 3 0.1 f 9.8304 mhz 10 k ? 10 k ? 5 6 + ptb0 ptb2 v dd 10 k ?
advance information MC68HC908RF2 ? rev. 1 154 monitor read-only memory (mon) motorola monitor read-only memory (mon) 10.4.1 monitor mode entry table 10-1 shows the pin conditions for entering monitor mode. enter monitor mode by either:  executing a software interrupt instruction (swi), or  applying a logic 0 and then a logic 1 to the rst pin note: upon entering monitor mode, an interrupt stack frame plus a stacked h register will leave the stack pointer at address $00f9. once out of reset, the mcu waits for the host to send eight security bytes (see 10.4.7 security ). after the security bytes, the mcu sends a break signal (10 consecutive logic 0s) to the host computer, indicating that it is ready to receive a command. monitor mode uses alternate vectors for reset, swi, and break interrupt. the alternate vectors are in the $fe page instead of the $ff page and allow code execution from the internal monitor firmware instead of user code. the cop module is disabled in monitor mode as long as v hi (see section 17. preliminary electrical specifications ) is applied to either the irq1 pin or the rst pin. (see section 6. system integration module (sim) for more information on modes of operation.) the icg module is bypassed in monitor mode as long as v hi is applied to the irq1 pin. rst does not affect the icg. table 10-1. monitor mode entry irq pin ptb0 pin ptb2 pin pta0 pin cgmout (2) bus frequency v hi (1) 101 1. for v hi , see 17.7 3.0-volt dc electrical characteristics excluding uhf module and 17.3 absolute maximum ratings . 2. if the high voltage (v hi ) is removed from the irq1 pin while in monitor mode, the clock select bit (cs) controls the source of cgmout. cgmxclk 2 ----------------------------- cgmout 2 --------------------------
monitor read-only memory (mon) functional description MC68HC908RF2 ? rev. 1 advance information motorola monitor read-only memory (mon) 155 table 10-2 is a summary of the differences between user mode and monitor mode. 10.4.2 data format communication with the monitor rom is in standard non-return-to-zero (nrz) mark/space data format. (see figure 10-2 and figure 10-3 .) the data transmit and receive rate is determined by the crystal. transmit and receive baud rates must be identical. figure 10-2. monitor data format figure 10-3. sample monitor waveforms table 10-2. mode differences modes functions cop reset vector high reset vector low break vector high break vector low swi vector high swi vector low user enabled $fffe $ffff $fffc $fffd $fffc $fffd monitor disabled (1) 1. if the high voltage (v hi ) is removed from the irq1 pin while in monitor mode, the sim asserts its cop enable output. the cop is a mask option enabled or disabled by the copd bit in the configuration register. see 17.7 3.0-volt dc electrical characteristics excluding uhf module . $fefe $feff $fefc $fefd $fefc $fefd bit 5 start bit bit 0 bit 1 next stop bit start bit bit 2 bit 3 bit 4 bit 6 bit 7 notes: 1 = echo delay (2 bit times) 2 = data return delay (2 bit times) 3 = wait 1 bit time before sending next byte. 1, 2, 3 bit 5 start bit bit 0 bit 1 next stop bit start bit bit 2 bit 3 bit 4 bit 6 bit 7 start bit bit 0 bit 1 next stop bit start bit bit 2 $a5 break bit 3 bit 4 bit 5 bit 6 bit 7 notes: 1 = echo delay (2 bit times) 2 = data return delay (2 bit times) 3 = wait 1 bit time before sending next byte. 1, 2, 3 1, 2, 3
advance information MC68HC908RF2 ? rev. 1 156 monitor read-only memory (mon) motorola monitor read-only memory (mon) 10.4.3 echoing as shown in figure 10-4 , the monitor rom immediately echoes each received byte back to the pta0 pin for error checking. any result of a command appears after the echo of the last byte of the command. figure 10-4. read transaction 10.4.4 break signal a start bit followed by nine low bits is a break signal. (see figure 10-5 .) when the monitor receives a break signal, it drives the pta0 pin high for the duration of two bits before echoing the break signal. figure 10-5. break transaction addr. high read read addr. high addr. low addr. low data echo sent to monitor result notes: 1 = echo delay (2 bit times) 2 = data return delay (2 bit times) 3 = wait 1 bit time before sending next byte. 1 3 1 3 1 2 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 missing stop bit 2-stop-bit delay before zero echo
monitor read-only memory (mon) functional description MC68HC908RF2 ? rev. 1 advance information motorola monitor read-only memory (mon) 157 10.4.5 commands the monitor rom uses these commands:  read, read memory  write, write memory  iread, indexed read  iwrite, indexed write  readsp, read stack pointer  run, run user program a sequence of iread or iwrite commands can access a block of memory sequentially over the full 64-kbyte memory map. table 10-3. read (read memory) command description read byte from memory operand specifies 2-byte address in high byte:low byte order data returned returns contents of specified address opcode $4a command sequence addr. high read read addr. high addr. low addr. low data echo sent to monitor result notes: 1 = echo delay (2 bit times) 2 = data return delay (2 bit times) 3 = wait 1 bit time before sending next byte. 1 31312
advance information MC68HC908RF2 ? rev. 1 158 monitor read-only memory (mon) motorola monitor read-only memory (mon) table 10-4. write (write memory) command description write byte to memory operand specifies 2-byte address in high byte:low byte order; low byte followed by data byte data returned none opcode $49 command sequence addr. high write write addr. high addr. low addr. low data echo sent to monitor data notes: 1 = echo delay (2 bit times) 2 = wait 1 bit time before sending next byte. 121 21 21 table 10-5. iread (indexed read) command description read next 2 bytes in memory from last address accessed operand specifies 2-byte address in high byte:low byte order data returned returns contents of next two addresses opcode $1a command sequence data iread iread data echo sent to monitor result notes: 1 = echo delay (2 bit times) 2 = data return delay (2 bit times) 12 2
monitor read-only memory (mon) functional description MC68HC908RF2 ? rev. 1 advance information motorola monitor read-only memory (mon) 159 table 10-6. iwrite (indexed write) command description write to last address accessed + 1 operand specifies single data byte data returned none opcode $19 command sequence data iwrite iwrite data echo sent to monitor notes: 1 = echo delay (2 bit times) 2 = wait 1 bit time before sending next byte. 121 table 10-7. readsp (read stack pointer) command description reads stack pointer operand none data returned returns stack pointer plus one in high byte:low byte order. the plus one is due to the use of the tsx instruction. opcode $0c command sequence sp high readsp readsp sp low echo sent to monitor result notes: 1 = echo delay (2 bit times) 2 = data return delay (2 bit times) 122
advance information MC68HC908RF2 ? rev. 1 160 monitor read-only memory (mon) motorola monitor read-only memory (mon) 10.4.6 baud rate with a 9.8304-mhz crystal, data is transferred between the monitor and host at 9600 baud. if a 14.7456-mhz crystal is used, the monitor baud rate is 14400. note: while in monitor mode with v hi applied to irq1 , the mcu bus clock is always driven from the external clock. 10.4.7 security a security feature discourages unauthorized reading of flash locations while in monitor mode. the host can bypass the security feature at monitor mode entry by sending eight consecutive security bytes that match the bytes at locations $fff6 ? $fffd. locations $fff6 ? $fffd contain user-defined data. note: do not leave locations $fff6 ? $fffd blank. for security reasons, program locations $fff6 ? $fffd even if they are not used for vectors. if flash is unprogrammed, the eight security byte values to be sent are $00, the unprogrammed state of the flash. during monitor mode entry, the mcu waits after the power-on reset for the host to send the eight security bytes on pin pa0. table 10-8. run (run user program) command description executes rti instruction operand none data returned none opcode $28 command sequence run run echo sent to monitor note 1 = echo delay (2 bit times) 1
monitor read-only memory (mon) functional description MC68HC908RF2 ? rev. 1 advance information motorola monitor read-only memory (mon) 161 figure 10-6. monitor mode entry timing if the received bytes match those at locations $fff6 ? $fffd, the host bypasses the security feature and can read all flash locations and execute code from flash. security remains bypassed until a power-on reset occurs. after the host bypasses security, any reset other than a power-on reset requires the host to send another eight bytes, but security remains bypassed regardless of the data that the host sends. if the received bytes do not match the data at locations $fff6 ? $fffd, the host fails to bypass the security feature. the mcu remains in monitor mode, but reading flash locations returns undefined data, and trying to execute code from flash causes an illegal address reset. after the host fails to bypass security, any reset other than a power-on reset causes an endless loop of illegal address resets. byte 1 byte 1 echo byte 2 byte 2 echo byte 8 byte 8 echo command command echo pa0 rst 4096 + 32 cgmxclk cycles 24 cgmxclk cycles 1 3 1 1 2 1 break notes: 1 = echo delay (2 bit times) 2 = data return delay (2 bit times) 3 = wait 1 bit time before sending next byte. 3 from host from mcu $fff6 $fff7 $fffd 256 cgmxclk cycles one bit time v dd irq1 see note note: any delay between rising irq1 and rising v dd will guarantee that the mcu bus is driven by the external clock.
advance information MC68HC908RF2 ? rev. 1 162 monitor read-only memory (mon) motorola monitor read-only memory (mon) after receiving the eight security bytes from the host, the mcu transmits a break character signalling that it is ready to receive a command. note: the mcu does not transmit a break character until after the host sends the eight security bytes.
MC68HC908RF2 ? rev. 1 advance information motorola computer operating properly module (cop) 163 advance information ? MC68HC908RF2 section 11. computer operating properly module (cop) 11.1 contents 11.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .164 11.3 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .164 11.4 i/o signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .165 11.4.1 cgmxclk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .165 11.4.2 stop instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .165 11.4.3 copctl write . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .166 11.4.4 power-on reset. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .166 11.4.5 internal reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .166 11.4.6 reset vector fetch. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .166 11.4.7 copd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .166 11.4.8 coprs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .166 11.5 cop control register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167 11.6 interrupts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .167 11.7 monitor mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .167 11.8 low-power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .167 11.8.1 wait mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .167 11.8.2 stop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .168 11.9 cop module during break interrupts . . . . . . . . . . . . . . . . . . .168
advance information MC68HC908RF2 ? rev. 1 164 computer operating properly module (cop) motorola computer operating properly module (cop) 11.2 introduction the computer operating properly (cop) module contains a free-running counter that generates a reset if allowed to overflow. the cop module helps software recover from runaway code. prevent a cop reset by periodically clearing the cop counter. 11.3 functional description figure 11-1. cop block diagram copctl write cgmxclk reset vector fetch reset reset status internal reset sources stop instruction clear stages 5 ? 12 clear all stages 6-bit cop counter copd from config reset copctl write clear cop counter coprs from config 12-bit cop prescaler register
computer operating properly module (cop) i/o signals MC68HC908RF2 ? rev. 1 advance information motorola computer operating properly module (cop) 165 the cop counter is a free-running 6-bit counter preceded by a 12-bit prescaler. if not cleared by software, the cop counter overflows and generates an asynchronous reset after 2 13 ? 2 4 or 2 18 ? 2 4 cgmxclk cycles, depending on the state of the cop rate select bit, coprs, in the configuration register. when coprs = 1, a 4.9152-mhz crystal gives a cop timeout period of 53.3 ms. writing any value to location $ffff before an overflow occurs prevents a cop reset by clearing the cop counter and stages 5 through 12 of the prescaler. note: service the cop immediately after reset and before entering or after exiting stop mode to guarantee the maximum time before the first cop counter overflow. a cop reset pulls the rst pin low for 32 cgmxclk cycles and sets the cop bit in the sim reset status register (srsr). in monitor mode, the cop is disabled if the rst pin or the irq1 pin is held at v hi . during the break state, v hi on the rst pin disables the cop. note: place cop clearing instructions in the main program and not in an interrupt subroutine. such an interrupt subroutine could keep the cop from generating a reset even while the main program is not working properly. 11.4 i/o signals the following paragraphs describe the signals shown in figure 11-1 . 11.4.1 cgmxclk cgmxclk is the oscillator output signal. see 8.4.5 clock selection circuit for a description of cgmxclk. 11.4.2 stop instruction the stop instruction clears the cop prescaler.
advance information MC68HC908RF2 ? rev. 1 166 computer operating properly module (cop) motorola computer operating properly module (cop) 11.4.3 copctl write writing any value to the cop control register (copctl) (see 11.5 cop control register ) clears the cop counter and clears stages 12 through 5 of the cop prescaler. reading the cop control register returns the reset vector. 11.4.4 power-on reset the power-on reset (por) circuit clears the cop prescaler 4096 cgmxclk cycles after power-up. 11.4.5 internal reset an internal reset clears the cop prescaler and the cop counter. 11.4.6 reset vector fetch a reset vector fetch occurs when the vector address appears on the data bus. a reset vector fetch clears the cop prescaler. 11.4.7 copd the copd signal reflects the state of the cop disable bit (copd) in the configuration register. (see section 9. configuration register (config) ). 11.4.8 coprs the coprs signal reflects the state of the cop rate select bit (coprs) in the configuration register. (see section 9. configuration register (config) ).
computer operating properly module (cop) cop control register MC68HC908RF2 ? rev. 1 advance information motorola computer operating properly module (cop) 167 11.5 cop control register the cop control register is located at address $ffff and overlaps the reset vector. writing any value to $ffff clears the cop counter and starts a new timeout period. reading location $ffff returns the low byte of the reset vector. 11.6 interrupts the cop does not generate cpu interrupt requests. 11.7 monitor mode the cop is disabled in monitor mode when v hi is present on the irq1 pin or on the rst pin. 11.8 low-power modes the wait and stop instructions put the mcu in low power- consumption standby modes. 11.8.1 wait mode the cop remains active in wait mode. to prevent a cop reset during wait mode, periodically clear the cop counter in a cpu interrupt routine. address: $ffff bit 7654321bit 0 read: low byte of reset vector write: clear cop counter reset: unaffected by reset figure 11-2. cop control register (copctl)
advance information MC68HC908RF2 ? rev. 1 168 computer operating properly module (cop) motorola computer operating properly module (cop) 11.8.2 stop mode stop mode turns off the cgmxclk input to the cop and clears the cop prescaler. service the cop immediately before entering or after exiting stop mode to ensure a full cop timeout period after entering or exiting stop mode. the stop bit (see section 9. configuration register (config) ) enables the stop instruction. to prevent inadvertently turning off the cop with a stop instruction, disable the stop instruction by clearing the stop bit. 11.9 cop module during break interrupts the cop is disabled during a break interrupt when v hi is present on the rst pin.
MC68HC908RF2 ? rev. 1 advance information motorola low-voltage inhibit (lvi) 169 advance information ? MC68HC908RF2 section 12. low-voltage inhibit (lvi) 12.1 contents 12.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .169 12.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .170 12.4 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .170 12.4.1 false trip protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . .171 12.4.2 short stop recovery option. . . . . . . . . . . . . . . . . . . . . . . .171 12.5 lvi status register. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .172 12.6 lvi interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .172 12.7 low-power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .172 12.7.1 wait mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .173 12.7.2 stop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .173 12.2 introduction the low-voltage inhibit (lvi) module monitors the voltage on the v dd pin and will set a low voltage sense bit when v dd voltage falls to the lvi sense voltage. the lvi will force a reset when the v dd voltage falls to the lvi trip voltage.
advance information MC68HC908RF2 ? rev. 1 170 low-voltage inhibit (lvi) motorola low-voltage inhibit (lvi) 12.3 features features of the lvi module include:  two levels of low-voltage condition are detected: ? low-voltage detection ? low-voltage reset  user-configurable for stop mode 12.4 functional description figure 12-1 shows the structure of the lvi module. the lvi module contains a bandgap reference circuit and two comparators. the lvi monitors v dd voltage during normal mcu operation. when enabled, the lvi module generates a reset when v dd falls below the v lvr threshold. in addition to forcing a reset condition, the lvi module has a second circuit dedicated to low-voltage detection. when v dd falls below v lvs , the output of the low-voltage comparator asserts the lowv flag in the lvi status register (lvisr). in applications that require detecting low batteries, software can monitor by polling the lowv bit. figure 12-1. lvi module block diagram dead detector stop instruction v dd > v lvr = 0 v dd v lvr = 1 v dd reset battery weak detector battery lowv v dd > v lvs = 0 v dd v lvs = 1 lowv flag v dd digital filter cgmxclk lvi stop bit in configuration register lvi pwr bit in configuration register lvirst bit in configuration register lvitrip
low-voltage inhibit (lvi) functional description MC68HC908RF2 ? rev. 1 advance information motorola low-voltage inhibit (lvi) 171 12.4.1 false trip protection the v dd pin level is digitally filtered to reduce false dead battery detection due to power supply noise. for the lvi module to reset due to a low-power supply, v dd must remain at or below the v lvr level for a minimum 32 ? 40 cgmxclk cycles. see table 12-1 . 12.4.2 short stop recovery option the lvi has an enable time of t en . the system stabilization time for power-on reset and long stop recovery (both 4096 cgmxclk cycles) gives a delay longer than the lvi enable time for these startup scenarios. there is no period where the mcu is not protected from a low-power condition. however, when using the short stop recovery configuration option, the 32 cgmxclk delay must be greater than the lvi turn on time to avoid a period in startup where the lvi is not protecting the mcu. note: the lvi is enabled automatically after reset or stop recovery, if the lvistop of the config register is set. (see section 9. configuration register (config) .) table 12-1. lowv bit indication v dd result at level: for number of cgmxclk cycles: v dd > v lvr any filter counter remains clear v dd < v lvr < 32 cgmxclk cycles no reset, continue counting cgmxclk v dd < v lvr between 32 & 40 cgmxclk cycles lvi may generate a reset after 32 cgmxclk cycles v dd < v lvr > 40 cgmxclk cycles lvi is guaranteed to generate a reset
advance information MC68HC908RF2 ? rev. 1 172 low-voltage inhibit (lvi) motorola low-voltage inhibit (lvi) 12.5 lvi status register the lvi status register flags v dd voltages below the v lvr and v lvs levels. lviout ? lvi output bit the read-only flag becomes set when the v dd voltage falls below the v lvr voltage for 32 to 40 cgmxclk cycles. reset clears the lviout bit. lowv ? lvi low indicator bit this read-only flag becomes set when the lvi is detecting v dd voltage below the v lvs threshold. 12.6 lvi interrupts the lvi module does not generate cpu interrupt requests. 12.7 low-power modes the stop and wait instructions put the mcu in low power- consumption standby modes. address: $fe0f bit 7654321bit 0 read: lviout 0 lowv 00000 write: reset:00000000 = unimplemented figure 12-2. lvi status register (lvisr)
low-voltage inhibit (lvi) low-power modes MC68HC908RF2 ? rev. 1 advance information motorola low-voltage inhibit (lvi) 173 12.7.1 wait mode the lvi module remains active in wait mode. the lvi module can generate a reset if a v dd voltage below the v lvr voltage is detected. 12.7.2 stop mode the lvi can be enabled or disabled in stop mode by setting the lvistop bit in the config register. (see section 9. configuration register (config) .) note: to minimize stop i dd, disable the lvi in stop mode.
advance information MC68HC908RF2 ? rev. 1 174 low-voltage inhibit (lvi) motorola low-voltage inhibit (lvi)
MC68HC908RF2 ? rev. 1 advance information motorola input/output (i/o) ports 175 advance information ? MC68HC908RF2 section 13. input/output (i/o) ports 13.1 contents 13.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .175 13.3 port a . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .177 13.3.1 port a data register . . . . . . . . . . . . . . . . . . . . . . . . . . . . .177 13.3.2 data direction register a. . . . . . . . . . . . . . . . . . . . . . . . . .178 13.4 port b . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .180 13.4.1 port b data register . . . . . . . . . . . . . . . . . . . . . . . . . . . . .180 13.4.2 data direction register b . . . . . . . . . . . . . . . . . . . . . . . . .181 13.2 introduction twelve bidirectional input/output (i/o) pins form two parallel ports in the 32-pin low-profile quad flat pack (lqfp). all i/o pins are programmable as inputs or outputs. port a bits pta6 ? pta1 have keyboard wakeup interrupts and internal pullup resistors. note: connect any unused i/o pins to an appropriate logic level, either v dd or v ss . although the i/o ports do not require termination for proper operation, termination reduces excess current consumption and the possibility of electrostatic damage.
advance information MC68HC908RF2 ? rev. 1 176 input/output (i/o) ports motorola input/output (i/o) ports addr. register name bit 7654321bit 0 $0000 port a data register (pta) see page 177. read: pta7 pta6 pta5 pta4 pta3 pta2 pta1 pta0 write: reset: unaffected by reset $0001 port b data register (ptb) see page 180. read: ptb3 ptb2 ptb1 ptb0 write: reset: unaffected by reset $0004 data direction register a (ddra) see page 178. read: ddra7 ddra6 ddra5 ddra4 ddra3 ddra2 ddra1 ddra0 write: reset:00000000 $0005 data direction register b (ddrb) see page 181. read: mclken 0 ddrb3 ddrb2 ddrb1 ddrb0 write: reset:00000000 = unimplemented figure 13-1. i/o port register summary
input/output (i/o) ports port a MC68HC908RF2 ? rev. 1 advance information motorola input/output (i/o) ports 177 13.3 port a port a is an 8-bit special function port that shares six of its pins with the keyboard interrupt module (kbd). pta6 ? pta1 contain pullup resistors enabled when the port pin is enabled as a keyboard interrupt. port a pins are also high-current port pins with 3-ma sink capabilities. 13.3.1 port a data register the port a data register (pta) contains a data latch for each of the eight port a pins. pta[7:0] ? port a data bits these read/write bits are software programmable. data direction of each port a pin is under the control of the corresponding bit in data direction register a. reset has no effect on port a data. kbd[6:1] ? keyboard wakeup pins the keyboard interrupt enable bits, kbie[6:1], in the keyboard interrupt control register enable the port a pin as external interrupt pins and related internal pullup resistor. see section 14. keyboard/external interrupt module (kbi) . note: the enabling of a keyboard interrupt pin will override the corresponding definition of the pin in the data direction register. however, the data direction register bit must be a logic 0 for software to read the pin. address: $0000 bit 7654321bit 0 read: pta7 pta6 pta5 pta4 pta3 pta2 pta1 pta0 write: reset: unaffected by reset alternate function: kbd6 kbd5 kbd4 kbd3 kbd2 kbd1 = unimplemented figure 13-2. port a data register (pta)
advance information MC68HC908RF2 ? rev. 1 178 input/output (i/o) ports motorola input/output (i/o) ports 13.3.2 data direction register a data direction register a (ddra) determines whether each port a pin is an input or an output. writing a logic 1 to a ddra bit enables the output buffer for the corresponding port a pin; a logic 0 disables the output buffer. ddra[7:0] ? data direction register a bits these read/write bits control port a data direction. reset clears ddra[7:0], configuring all port a pins as inputs. 1 = corresponding port a pin configured as output 0 = corresponding port a pin configured as input note: avoid glitches on port a pins by writing to the port a data register before changing data direction register a bits from 0 to 1. figure 13-4 shows the port a i/o logic. when bit ddrax is a logic 1, reading address $0000 reads the ptax data latch. when bit ddrax is a logic 0, reading address $0000 reads the voltage level on the pin. the data latch can always be written, regardless of the state of its data direction bit. table 13-1 summarizes the operation of the port a pins. address: $0004 bit 7654321bit 0 read: ddra7 ddra6 ddra5 ddra4 ddra3 ddra2 ddra1 ddra0 write: reset:00000000 figure 13-3. data direction register a (ddra)
input/output (i/o) ports port a MC68HC908RF2 ? rev. 1 advance information motorola input/output (i/o) ports 179 figure 13-4. port a i/o circuit note: setting a keyboard interrupt enable bit (kbiex) forces the corresponding keyboard interrupt pin to be an input, overriding the data direction register. however, the data direction register bit must be a logic 0 for software to read the pin. read ddra ($0004) write ddra ($0004) reset write pta ($0000) read pta ($0000) ddrax ptax internal data bus ptax v dd kbie x internal pullup device table 13-1. port a pin functions kbie (2) bit ddra bit pta bit i/o pin mode accesses to ddra accesses to pta read/write read write 1x x (1) input, v dd (4) ddra[7:0] pin pta[7:0] (3) 00x input, hi-z (5) ddra[7:0] pin pta[7:0] (3) 0 1 x output ddra[7:0] pta[7:0] pta[7:0] notes: 1. x = don ? t care 2. keyboard interrupt enable bit (see 14.6.2 keyboard interrupt enable register ) 3. writing affects data register, but does not affect input. 4. i/o pin pulled up to v dd by internal pullup device 5. hi-z = high impedance
advance information MC68HC908RF2 ? rev. 1 180 input/output (i/o) ports motorola input/output (i/o) ports 13.4 port b port b is a 4-bit special function port that shares two of its pins with the timer (tim) module and one with the buffered internal bus clock mclk. 13.4.1 port b data register the port b data register (ptb) contains a data latch for each of the four port b pins. ptb[3:0] ? port b data bits these read/write bits are software-programmable. data direction of each port b pin is under the control of the corresponding bit in data direction register b. reset has no effect on port b data. tch0 ? timer channel i/o bit the ptb2/tch0 pin is the tim channel 0 input capture/output compare pin. the edge/level select bits, els0b:els0a, determine whether the ptb2/tch0 pin is a timer channel i/o or a general- purpose i/o pin. see section 15. timer interface module (tim) . tclk ? timer clock bit the ptb3/tclk pin is the external clock input for tim. the prescaler select bits, ps[2:0], select ptb3/tclk as the tim clock input. (see 15.9.1 tim status and control register .) when not selected as the tim clock, ptb3/tclk is available for general-purpose i/o. address: $0001 bit 7654321bit 0 read: ptb3 ptb2 ptb1 ptb0 write: reset: unaffected by reset alternate functions: tclk tch0 mclk = unimplemented figure 13-5. port b data register (ptb)
input/output (i/o) ports port b MC68HC908RF2 ? rev. 1 advance information motorola input/output (i/o) ports 181 mclk ? bus clock bit the bus clock (mclk) is driven out of pin ptb0/mclk when enabled by the mclken bit in port b data direction register bit 7. 13.4.2 data direction register b data direction register b (ddrb) determines whether each port b pin is an input or an output. writing a logic 1 to a ddrb bit enables the output buffer for the corresponding port b pin; a logic 0 disables the output buffer. mclken ? mclk enable bit this read/write bit enables mclk to be an output signal on ptb0. if mclk is enabled, ptb0 is under the control of mclken. reset clears this bit. 1 = mclk output enabled 0 = mclk output disabled ddrb[3:0] ? data direction register b bits these read/write bits control port b data direction. reset clears ddrb[3:0], configuring all port b pins as inputs. 1 = corresponding port b pin configured as output 0 = corresponding port b pin configured as input note: avoid glitches on port b pins by writing to the port b data register before changing data direction register b bits from 0 to 1. address: $0005 bit 7654321bit 0 read: mclken 0 ddrb3 ddrb2 ddrb1 ddrb0 write: reset:00000000 = unimplemented figure 13-6. data direction register b (ddrb)
advance information MC68HC908RF2 ? rev. 1 182 input/output (i/o) ports motorola input/output (i/o) ports figure 13-7 shows the port b i/o logic. figure 13-7. port b i/o circuit when bit ddrbx is a logic 1, reading address $0001 reads the ptbx data latch. when bit ddrbx is a logic 0, reading address $0001 reads the voltage level on the pin. the data latch can always be written, regardless of the state of its data direction bit. table 13-2 summarizes the operation of the port b pins. table 13-2. port b pin functions ddrb bit ptb bit i/o pin mode accesses to ddrb accesses to ptb read/write read write 0 x input, hi-z ddrb[7] ddrb[3:0] pin ptb[3:0] (1) 1 x output ddrb[7] ddrb[3:0] ptb[3:0] ptb[3:0] x = don ? t care hi-z = high impedance 1. writing affects data register, but does not affect input. read ddrb ($0005) write ddrb ($0005) reset write ptb ($0001) read ptb ($0001) ptbx ddrbx ptbx internal data bus
MC68HC908RF2 advance information motorola keyboard/external interrupt module (kbi) 183 advance information ? MC68HC908RF2 section 14. keyboard/external interrupt module (kbi) 14.1 contents 14.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .183 14.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .184 14.4 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .184 14.4.1 external interrupt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .184 14.4.2 irq1 pin. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .188 14.4.3 kbi module during break interrupts. . . . . . . . . . . . . . . . . .189 14.4.4 keyboard interrupt pins . . . . . . . . . . . . . . . . . . . . . . . . . . .189 14.4.5 keyboard initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191 14.5 low-power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .192 14.5.1 wait mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .192 14.5.2 stop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .192 14.6 i/o registers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .193 14.6.1 irq and keyboard status and control register . . . . . . . .193 14.6.2 keyboard interrupt enable register . . . . . . . . . . . . . . . . . .195 14.2 introduction this section describes the maskable external interrupt (irq1 ) input and six independently maskable keyboard wakeup interrupt pins.
advance information MC68HC908RF2 184 keyboard/external interrupt module (kbi) motorola keyboard/external interrupt module (kbi) 14.3 features features of the kbi include:  dedicated external interrupt pin (irq1 )  six keyboard interrupt pins with separate keyboard interrupt enable bits and one keyboard interrupt mask  internal pullup resistor  hysteresis buffer  programmable edge-only or edge- and level-interrupt sensitivity  automatic interrupt acknowledge 14.4 functional description this section provides a functional description of the keyboard/external interrupt module (kbi). 14.4.1 external interrupt a logic 0 applied to the external interrupt pin (irq1 ) can latch a cpu interrupt request. figure 14-1 shows the structure of the external (irq1 ) interrupt of the kbi module. a logic 0 applied to one or more of the keyboard interrupt pins can latch a cpu interrupt request. figure 14-4 shows the structure of the keyboard interrupts of the kbi module see figure 14-2 for a summary of the interrupt and keyboard input/output (i/o) registers.
keyboard/external interrupt module (kbi) functional description MC68HC908RF2 advance information motorola keyboard/external interrupt module (kbi) 185 figure 14-1. irq block diagram acki imaski dq ck clr irq1 high interrupt to mode select logic irq1 latch request irq1 v dd modei voltage detect synchro- nizer irq1f to cpu for bil/bih instructions vector fetch decoder internal address bus v dd keyboard interrupt request irq1/keyboard interrupt request internal pullup device reset addr. register name bit 7654321bit 0 $001a irq and keyboard status and control register (intkbscr) see page 193. read: irq1f 0 imaski modei keyf 0 imaskk modek write: r acki r ackk reset:00000000 $001b keyboard interrupt enable register (intkbier) see page 195. read: 0 kbie6 kbie5 kbie4 kbie3 kbie2 kbie1 0 write: reset:00000000 = unimplemented r = reserved figure 14-2. irq and keyboard i/o register summary
advance information MC68HC908RF2 186 keyboard/external interrupt module (kbi) motorola keyboard/external interrupt module (kbi) interrupt signals on the irq1 pin are latched into the irq1 latch. keyboard interrupts are latched in the keyboard interrupt latch. an interrupt latch remains set until one of these actions occurs:  vector fetch ? a vector fetch automatically generates an interrupt acknowledge signal that clears irq1 latch and keyboard interrupt latch.  software clear ? software can clear an interrupt latch by writing to the appropriate acknowledge bit in the interrupt status and control register (intkbscr). writing a logic 1 to the acki bit clears the irq1 latch. writing a logic 1 to the ackk bit clears the keyboard interrupt latch.  reset ? a reset automatically clears both interrupt latches. the irq1 pin and keyboard interrupt pins are falling-edge triggered and are software-configurable to be both falling-edge and low-level triggered. the modei and modek bits in the intkbscr controls the triggering sensitivity of the irq1 pin and keyboard interrupt pins. when an interrupt pin is edge-triggered only, the interrupt latch remains set until a vector fetch, software clear, or reset occurs. when an interrupt pin is both falling-edge and low-level-triggered, the interrupt latch remains set until both of these occur:  vector fetch or software clear  return of the interrupt pin to logic 1 the vector fetch or software clear may occur before or after the interrupt pin returns to logic 1. as long as the pin is low, the interrupt request remains pending. a reset will clear the latch, the modei and modek control bits, thereby clearing the interrupt even if the pin stays low. when set, the imaski and imaskk bits in the intkbscr mask all external interrupt requests. a latched interrupt request is not presented to the interrupt priority logic unless the corresponding imask bit is clear.
keyboard/external interrupt module (kbi) functional description MC68HC908RF2 advance information motorola keyboard/external interrupt module (kbi) 187 note: the interrupt mask (i) in the condition code register (ccr) masks all interrupt requests, including external interrupt requests. see figure 14-3 . figure 14-3. irq interrupt flowchart from reset i bit set? fetch next yes no interrupt? instruction swi instruction? rti instruction? no stack cpu registers no set i bit load pc with interrupt vector no yes unstack cpu registers execute instruction yes yes
advance information MC68HC908RF2 188 keyboard/external interrupt module (kbi) motorola keyboard/external interrupt module (kbi) 14.4.2 irq1 pin a logic 0 on the irq1 pin can latch an interrupt request into the irq1 latch. a vector fetch, software clear, or reset clears the irq1 latch. if the modei bit is set, the irq1 pin is both falling-edge sensitive and low-level sensitive. with modei set, both of these actions must occur to clear the irq1 latch:  vector fetch or software clear ? a vector fetch generates an interrupt acknowledge signal to clear the latch. software may generate the interrupt acknowledge signal by writing a logic 1 to the acki bit in the irq and keyboard status and control register (intkbscr). the acki bit is useful in applications that poll the irq1 pin and require software to clear the irq1 latch. writing to the acki bit can also prevent spurious interrupts due to noise. setting acki does not affect subsequent transitions on the irq1 pin. a falling edge on irq1 that occurs after writing to the acki bit latches another interrupt request. if the irq1 mask bit, imaski, is clear, the cpu loads the program counter with the vector address at locations $fffa and $fffb.  return of the irq1 pin to logic 1 ? as long as the irq1 pin is at logic 0, the irq1 latch remains set. the vector fetch or software clear and the return of the irq1 pin to logic 1 can occur in any order. the interrupt request remains pending as long as the irq1 pin is at logic 0. a reset will clear the latch and the modei control bit, thereby clearing the interrupt even if the pin stays low. if the modei bit is clear, the irq1 pin is falling-edge sensitive only. with modei clear, a vector fetch or software clear immediately clears the irq1 latch.the irq1f bit in the intkbscr register can be used to check for pending interrupts. the irq1f bit is not affected by the imaski bit, which makes it useful in applications where polling is preferred. use the bih or bil instruction to read the logic level on the irq1 pin. note: when using the level-sensitive interrupt trigger, avoid false interrupts by masking interrupt requests in the interrupt routine.
keyboard/external interrupt module (kbi) functional description MC68HC908RF2 advance information motorola keyboard/external interrupt module (kbi) 189 14.4.3 kbi module during break interrupts the system integration module (sim) controls whether the irq1 or keyboard interrupt latches can be cleared during the break state. the bcfe bit in the break flag control register (bfcr) enables software to clear the latches during the break state. (see 6.8.3 sim break flag control register .) to allow software to clear the irq1 or keyboard latches during a break interrupt, write a logic 1 to the bcfe bit. if a latch is cleared during the break state, it remains cleared when the mcu exits the break state. to protect the latch during the break state, write a logic 0 to the bcfe bit. with bcfe at logic 0 (its default state), writing to the acki or ackk bits in the irq and keyboard status and control register during the break state has no effect on the irq1 or keyboard latches. 14.4.4 keyboard interrupt pins writing to the kbie6 ? kbie1 bits in the keyboard interrupt enable register independently enables or disables each port a pin as a keyboard interrupt pin. enabling a keyboard interrupt pin also enables its internal pullup device. a logic 0 applied to an enabled keyboard interrupt pin latches an irq1/keyboard interrupt request. an irq1/keyboard interrupt is latched when one or more keyboard pins goes low after all were high. the modek bit in the keyboard status and control register controls the triggering mode of the keyboard interrupt.  if the keyboard interrupt is edge-sensitive only, a falling edge on a keyboard pin does not latch an interrupt request if another keyboard pin is already low. to prevent losing an interrupt request on one pin because another pin is still low, software can disable the latter pin while it is low.  if the keyboard interrupt is falling edge- and low level-sensitive, an interrupt request is present as long as any keyboard pin is low.
advance information MC68HC908RF2 190 keyboard/external interrupt module (kbi) motorola keyboard/external interrupt module (kbi) figure 14-4. keyboard interrupt block diagram if the modek bit is set, the keyboard interrupt pins are both falling edge- and low level-sensitive, and both of these actions must occur to clear a keyboard interrupt request:  vector fetch or software clear ? a vector fetch generates an interrupt acknowledge signal to clear the interrupt request. software may generate the interrupt acknowledge signal by writing a logic 1 to the ackk bit in the keyboard status and control register (intkbscr). the ackk bit is useful in applications that poll the keyboard interrupt pins and require software to clear the keyboard interrupt request. writing to the ackk bit prior to leaving an interrupt service routine also can prevent spurious interrupts due to noise. setting ackk does not affect subsequent transitions on the keyboard interrupt pins. a falling edge that occurs after writing to the ackk bit latches another interrupt request. if the keyboard interrupt mask bit, imaskk, is clear, the cpu loads the program counter with the vector address at locations $fffa and $fffb.  return of all enabled keyboard interrupt pins to logic 1. as long as any enabled keyboard interrupt pin is at logic 0, the keyboard interrupt remains set. kb1ie kb6ie . . . keyboard interrupt dq ck clr v dd modek imaskk keyboard interrupt latch request vector fetch decoder ackk internal bus reset to pullup kbd6 kbd1 to pullup synchronizer keyf enable enable irq1 interrupt request irq1/keyboard interrupt request
keyboard/external interrupt module (kbi) functional description MC68HC908RF2 advance information motorola keyboard/external interrupt module (kbi) 191 the vector fetch or software clear and the return of all enabled keyboard interrupt pins to logic 1 may occur in any order. if the modek bit is clear, the keyboard interrupt pin is falling edge- sensitive only. with modek clear, a vector fetch or software clear immediately clears the keyboard interrupt request. reset clears the keyboard interrupt request and the modek bit, clearing the interrupt request even if a keyboard interrupt pin stays at logic 0. the keyboard flag bit (keyf) in the irq and keyboard status and control register can be used to see if a pending interrupt exists. the keyf bit is not affected by the keyboard interrupt mask bit (imaskk) which makes it useful in applications where polling is preferred. to determine the logic level on a keyboard interrupt pin, use the data direction register to configure the pin as an input and read the data register. note: setting a keyboard interrupt enable bit (kbie) forces the corresponding keyboard interrupt pin to be an input, overriding the data direction register. however, the data direction register bit must be a logic 0 for software to read the pin. 14.4.5 keyboard initialization when a keyboard interrupt pin is enabled, it takes time for the internal pullup to reach a logic 1. therefore, a false interrupt can occur as soon as the pin is enabled. to prevent a false interrupt on keyboard initialization: 1. mask keyboard interrupts by setting the imaskk bit in the keyboard status and control register. 2. enable the kbi pins by setting the appropriate kbiex bits in the keyboard interrupt enable register. 3. write to the ackk bit in the keyboard status and control register to clear any false interrupts. 4. clear the imaskk bit.
advance information MC68HC908RF2 192 keyboard/external interrupt module (kbi) motorola keyboard/external interrupt module (kbi) an interrupt signal on an edge-triggered pin can be acknowledged immediately after enabling the pin. an interrupt signal on an edge- and level-triggered interrupt pin must be acknowledged after a delay that depends on the external load. another way to avoid a false interrupt: 1. configure the keyboard pins as outputs by setting the appropriate ddra bits in data direction register a. 2. write logic 1s to the appropriate port a data register bits. 3. enable the kbi pins by setting the appropriate kbiex bits in the keyboard interrupt enable register. 14.5 low-power modes the wait and stop instructions put the mcu in low power- consumption standby modes. 14.5.1 wait mode the irq1/keyboard interrupts remain active in wait mode. clearing the imaski or imaskk bits in the irq and keyboard status and control register enables keyboard interrupt requests to bring the mcu out of wait mode. 14.5.2 stop mode the irq1/keyboard interrupt remains active in stop mode. clearing the imaski or imaskk bit in the irq and keyboard status and control register enables keyboard interrupt requests to bring the mcu out of stop mode.
keyboard/external interrupt module (kbi) i/o registers MC68HC908RF2 advance information motorola keyboard/external interrupt module (kbi) 193 14.6 i/o registers these registers control and monitor operation of the keyboard/external interrupt module:  irq and keyboard status and control register, intkbscr  keyboard interrupt enable register, kbier 14.6.1 irq and keyboard status and control register the irq and keyboard status and control register (intkbscr) controls and monitors operation of the keyboard/external interrupt module. the intkbscr has these functions:  flags the keyboard interrupt requests  acknowledges the keyboard interrupt requests  masks the keyboard interrupt requests  shows the state of the irq1 interrupt flag  clears the irq1 interrupt latch  masks the irq1 interrupt request  controls the triggering sensitivity of the keyboard and irq1 interrupt pins irq1f ? irq1 flag bit this read-only status bit is high when the irq1 interrupt is pending. 1 = irq1 interrupt pending 0 = irq1 interrupt not pending address: $001a bit 7654321bit 0 read: irq1f 0 imaski modei keyf 0 imaskk modek write: r acki r ackk reset:00000000 r= reserved figure 14-5. irq and keyboard status and control register (intkbscr)
advance information MC68HC908RF2 194 keyboard/external interrupt module (kbi) motorola keyboard/external interrupt module (kbi) acki ? irq1 interrupt request acknowledge bit writing a logic 1 to this write-only bit clears the irq1 latch. acki always reads as logic 0. reset clears acki. imaski ? irq1 interrupt mask bit writing a logic 1 to this read/write bit disables irq1 interrupt requests. reset clears imaski. 1 = irq1 interrupt requests disabled 0 = irq1 interrupt requests enabled modei ? irq1 triggering sensitivity bit this read/write bit controls the triggering sensitivity of the irq1 pin. reset clears modei. 1 = irq1 interrupt requests on falling edges and low levels 0 = interrupt requests on falling edges only keyf ? keyboard flag bit this read-only bit is set when a keyboard interrupt is pending. reset clears the keyf bit. 1 = keyboard interrupt pending 0 = no keyboard interrupt pending ackk ? keyboard acknowledge bit writing a logic 1 to this write-only bit clears the keyboard interrupt request. ackk always reads as logic 0. reset clears ackk. imaskk ? keyboard interrupt mask bit writing a logic 1 to this read/write bit prevents the output of the keyboard interrupt mask from generating interrupt requests. reset clears the imaskk bit. 1 = keyboard interrupt requests masked 0 = keyboard interrupt requests not masked modek ? keyboard triggering sensitivity bit this read/write bit controls the triggering sensitivity of the keyboard interrupt pins. reset clears modek. 1 = keyboard interrupt requests on falling edges and low levels 0 = keyboard interrupt requests on falling edges only
keyboard/external interrupt module (kbi) i/o registers MC68HC908RF2 advance information motorola keyboard/external interrupt module (kbi) 195 14.6.2 keyboard interrupt enable register the keyboard interrupt enable register (intkbier) enables or disables each port a pin to operate as a keyboard interrupt pin. kbie6 ? kbie1 ? keyboard interrupt enable bits each of these read/write bits enables the corresponding keyboard interrupt pin to latch interrupt requests. these bits also enable the corresponding internal pullup resistor which is enabled only when the bit is set. reset clears the keyboard interrupt enable register. 1 = pax pin enabled as keyboard interrupt pin and corresponding internal pullup resistor enabled 0 = pax pin not enabled as keyboard interrupt pin and corresponding internal pullup resistor disabled note: setting a keyboard interrupt enable bit (kbiex) forces the corresponding keyboard interrupt pin to be an input, overriding the data direction register. however, the data direction register bit must be a logic 0 for software to read the pin. address: $001b bit 7654321bit 0 read: 0 kbie6 kbie5 kbie4 kbie3 kbie2 kbie1 0 write: reset:00000000 = unimplemented figure 14-6. keyboard interrupt enable register (intkbier)
advance information MC68HC908RF2 196 keyboard/external interrupt module (kbi) motorola keyboard/external interrupt module (kbi)
MC68HC908RF2 ? rev. 1 advance information motorola timer interface module (tim) 197 advance information ? MC68HC908RF2 section 15. timer interface module (tim) 15.1 contents 15.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .198 15.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .198 15.4 pin name conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .199 15.5 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .199 15.5.1 tim counter prescaler . . . . . . . . . . . . . . . . . . . . . . . . . . . .202 15.5.2 input capture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .202 15.5.3 output compare . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .202 15.5.4 unbuffered output compare . . . . . . . . . . . . . . . . . . . . . . .202 15.5.5 buffered output compare . . . . . . . . . . . . . . . . . . . . . . . . .203 15.5.6 pulse-width modulation (pwm) . . . . . . . . . . . . . . . . . . . . .204 15.5.7 unbuffered pwm signal generation . . . . . . . . . . . . . . . . .205 15.5.8 buffered pwm signal generation . . . . . . . . . . . . . . . . . . .206 15.5.9 pwm initialization. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .207 15.6 interrupts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .208 15.6.1 low-power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .208 15.6.2 wait mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .208 15.6.3 stop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .209 15.7 tim during break interrupts . . . . . . . . . . . . . . . . . . . . . . . . . .209 15.8 i/o signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .209 15.8.1 tim clock pin (tclk) . . . . . . . . . . . . . . . . . . . . . . . . . . . .210 15.8.2 tim channel i/o pins (tch0) . . . . . . . . . . . . . . . . . . . . . .210 15.9 i/o registers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .210 15.9.1 tim status and control register . . . . . . . . . . . . . . . . . . . .211 15.9.2 tim counter registers . . . . . . . . . . . . . . . . . . . . . . . . . . . .213 15.9.3 tim counter modulo registers . . . . . . . . . . . . . . . . . . . . .214 15.9.4 tim channel status and control registers . . . . . . . . . . . .214 15.9.5 tim channel registers. . . . . . . . . . . . . . . . . . . . . . . . . . . .218
advance information MC68HC908RF2 ? rev. 1 198 timer interface module (tim) motorola timer interface module (tim) 15.2 introduction this section describes the timer interface module (tim). the tim is a 2-channel timer:  the first channel, channel 0, provides a timing reference with input capture, output compare, and pulse-width-modulation (pwm) functions.  the second channel, channel 1, provides reduced functionality as it doesn ? t have an external pin. figure 15-1 is a block diagram of the tim. 15.3 features features of the tim include:  one input capture/output compare channel: ? rising-edge, falling-edge, or any-edge input capture trigger ? set, clear, or toggle output compare action  buffered and unbuffered pwm signal generation  programmable tim clock input: ? 7-frequency internal bus clock prescaler selection ? external tim clock input (bus frequency 2 maximum)  free-running or modulo up-count operation  toggle any channel pin on overflow  tim counter stop and reset bits
timer interface module (tim) pin name conventions MC68HC908RF2 ? rev. 1 advance information motorola timer interface module (tim) 199 15.4 pin name conventions the tim module shares pins with two port b input/output (i/o) port pins. the full names of the tim i/o pins and generic pin names are listed in table 15-1 . 15.5 functional description figure 15-1 shows the structure of the tim. the central component of the tim is the 16-bit tim counter that can operate as a free-running counter or a modulo up-counter. the tim counter provides the timing reference for the input capture and output compare functions. the tim counter modulo registers, tmodh and tmodl, control the modulo value of the tim counter. software can read the tim counter value at any time without affecting the counting sequence. the tim channel 0 is programmable independently as input capture or output compare. the tim channel 1 is programmable only as output compare. the output compare is detected only through an interrupt. warning: tim channel 1 should not be configured as an input capture because this would result in a floating input that would cause a higher i dd . refer to figure 15-2 for a summary of the tim i/o registers. table 15-1. pin name conventions tim generic pin names tch0 tclk full tim pin names ptb2/tch0 ptb3/tclk
advance information MC68HC908RF2 ? rev. 1 200 timer interface module (tim) motorola timer interface module (tim) figure 15-1. tim block diagram prescaler prescaler select 16-bit comparator ps2 ps1 ps0 16-bit comparator 16-bit latch tch0h:tch0l ms0a els0b els0a port tof toie inter- 16-bit comparator 16-bit latch tch1h:tch1l channel 0 channel 1 tmodh:tmodl trst tstop tov0 ch0ie ch0f els1b els1a tov1 ch1ie ch1max ch1f ch0max ms0b 16-bit counter internal bus bus clock ms1a logic rupt logic inter- rupt logic port logic inter- rupt logic ptb3/tclk ptb2/tch0 n/c* internal *this pin is not available on the MC68HC908RF2. addr. register name bit 7654321bit 0 $0020 timer status and control register (tsc) see page 211. read: tof toie tstop 00 ps2 ps1 ps0 write: 0 trst reset:00100000 $0021 timer counter register high (tcnth) see page 213. read: bit 15 14 13 12 11 10 9 bit 8 write: reset:00000000 = unimplemented figure 15-2. tim i/o register summary
timer interface module (tim) functional description MC68HC908RF2 ? rev. 1 advance information motorola timer interface module (tim) 201 $0022 timer counter register low (tcntl) see page 213. read: bit 7 6 54321bit 0 write: reset:00000000 $0023 timer counter modulo register high (tmodh) see page 214. read: bit 15 14 13 12 11 10 9 bit 8 write: reset:11111111 $0024 timer counter modulo register low (tmodl) s ee page 214. read: bit 7654321bit 0 write: reset:11111111 $0025 timer channel 0 status and control register (tsc0) see page 215. read: ch0f ch0ie ms0b ms0a els0b els0a tov0 ch0max write: 0 reset:00000000 $0026 timer channel 0 register high (tch0h) see page 219. read: bit 15 14 13 12 11 10 9 bit 8 write: reset: indeterminate after reset $0027 timer channel 0 register low (tch0l) see page 219. read: bit 7654321bit 0 write: reset: indeterminate after reset $0028 timer channel 1 status and control register (tsc1) see page 215. read: ch1f ch1ie 0 ms1a els1b els1a tov1 ch1max write: 0 reset:00000000 $0029 timer channel 1 register high (tch1h)) see page 219. read: bit 15 14 13 12 11 10 9 bit 8 write: reset: indeterminate after reset $002a timer channel 1 register low (tch1l)) see page 219. read: bit 7654321bit 0 write: reset: indeterminate after reset addr. register name bit 7654321bit 0 = unimplemented figure 15-2. tim i/o register summary (continued)
advance information MC68HC908RF2 ? rev. 1 202 timer interface module (tim) motorola timer interface module (tim) 15.5.1 tim counter prescaler the tim clock source can be one of the seven prescaler outputs or the tim clock pin, tclk. the prescaler generates seven clock rates from the internal bus clock. the prescaler select bits, ps[2:0], in the tim status and control register select the tim clock source. 15.5.2 input capture with the input capture function, the tim can capture the time at which an external event occurs. when an active edge occurs on the pin of an input capture channel, the tim latches the contents of the tim counter into the tim channel registers, tchxh and tchxl. the polarity of the active edge is programmable. input captures can generate tim cpu interrupt requests. note: tim channel 1 should not be configured in this mode. 15.5.3 output compare with the output compare function, the tim can generate a periodic pulse with a programmable polarity, duration, and frequency. when the counter reaches the value in the registers of an output compare channel, the tim channel 0 can set, clear, or toggle the channel pin. output compares can generate tim cpu interrupt requests for both tim channel 0 and tim channel 1. note: tim channel 1 does not have an external pin associated with it. 15.5.4 unbuffered output compare any output compare channel can generate unbuffered output compare pulses as described in 15.5.3 output compare . the pulses are unbuffered because changing the output compare value requires writing the new value over the old value currently in the tim channel registers.
timer interface module (tim) functional description MC68HC908RF2 ? rev. 1 advance information motorola timer interface module (tim) 203 an unsynchronized write to the tim channel registers to change an output compare value could cause incorrect operation for up to two counter overflow periods. for example, writing a new value before the counter reaches the old value but after the counter reaches the new value prevents any compare during that counter overflow period. also, using a tim overflow interrupt routine to write a new, smaller output compare value may cause the compare to be missed. the tim may pass the new value before it is written. use these methods to synchronize unbuffered changes in the output compare value on channel x:  when changing to a smaller value, enable channel x output compare interrupts and write the new value in the output compare interrupt routine. the output compare interrupt occurs at the end of the current output compare pulse. the interrupt routine has until the end of the counter overflow period to write the new value.  when changing to a larger output compare value, enable channel x tim overflow interrupts and write the new value in the tim overflow interrupt routine. the tim overflow interrupt occurs at the end of the current counter overflow period. writing a larger value in an output compare interrupt routine (at the end of the current pulse) could cause two output compares to occur in the same counter overflow period. 15.5.5 buffered output compare channels 0 and 1 can be linked to form a buffered output compare channel whose output appears on the ptb2/tch0 pin. the tim channel registers of the linked pair alternately control the output. setting the ms0b bit in tim channel 0 status and control register (tsc0) links channel 0 and channel 1. the output compare value in the tim channel 0 registers initially controls the output on the tch0 pin. writing to the tim channel 1 registers enables the tim channel 1 registers to synchronously control the output after the tim overflows. at each subsequent overflow, the tim channel registers (0 or 1) that control the output are the ones written to last. tsc0 controls and monitors the
advance information MC68HC908RF2 ? rev. 1 204 timer interface module (tim) motorola timer interface module (tim) buffered output compare function, and tim channel 1 status and control register (tsc1) is unused. note: in buffered output compare operation, do not write new output compare values to the currently active channel registers. writing to the active channel registers is the same as generating unbuffered output compares. 15.5.6 pulse-width modulation (pwm) by using the toggle-on-overflow feature with an output compare channel, the tim can generate a pulse-width modulation (pwm) signal. the value in the tim counter modulo registers determines the period of the pwm signal. the channel pin toggles when the counter reaches the value in the tim counter modulo registers. the time between overflows is the period of the pwm signal. as figure 15-3 shows, the output compare value in the tim channel registers determines the pulse width of the pwm signal. the time between overflow and output compare is the pulse width. program the tim to clear channel 0 pin on output compare if the state of the pwm pulse is logic 1. program the tim to set the pin if the state of the pwm pulse is logic 0. figure 15-3. pwm period and pulse width ptb2/tch0 period pulse width overflow overflow overflow output compare output compare output compare
timer interface module (tim) functional description MC68HC908RF2 ? rev. 1 advance information motorola timer interface module (tim) 205 the value in the tim counter modulo registers and the selected prescaler output determines the frequency of the pwm output. the frequency of an 8-bit pwm signal is variable in 256 increments. writing $00ff (255) to the tim counter modulo registers produces a pwm period of 256 times the internal bus clock period if the prescaler select value is $000. see 15.9.1 tim status and control register . the value in the tim channel registers determines the pulse width of the pwm output. the pulse width of an 8-bit pwm signal is variable in 256 increments. writing $0080 (128) to the tim channel registers produces a duty cycle of 128/256 or 50 percent. 15.5.7 unbuffered pwm signal generation any output compare channel can generate unbuffered pwm pulses as described in 15.5.6 pulse-width modulation (pwm) . the pulses are unbuffered because changing the pulse width requires writing the new pulse width value over the old value currently in the tim channel registers. an unsynchronized write to the tim channel registers to change a pulse width value could cause incorrect operation for up to two pwm periods. for example, writing a new value before the counter reaches the old value but after the counter reaches the new value prevents any compare during that pwm period. also, using a tim overflow interrupt routine to write a new, smaller pulse width value may cause the compare to be missed. the tim may pass the new value before it is written. use these methods to synchronize unbuffered changes in the pwm pulse width on channel:  when changing to a shorter pulse width, enable channel output compare interrupts and write the new value in the output compare interrupt routine. the output compare interrupt occurs at the end of the current pulse. the interrupt routine has until the end of the pwm period to write the new value.  when changing to a longer pulse width, enable channel tim overflow interrupts and write the new value in the tim overflow interrupt routine. the tim overflow interrupt occurs at the end of
advance information MC68HC908RF2 ? rev. 1 206 timer interface module (tim) motorola timer interface module (tim) the current pwm period. writing a larger value in an output compare interrupt routine (at the end of the current pulse) could cause two output compares to occur in the same pwm period. note: in pwm signal generation, do not program the pwm channel to toggle on output compare. toggling on output compare prevents reliable 0 percent duty cycle generation and removes the ability of the channel to self-correct in the event of software error or noise. toggling on output compare also can cause incorrect pwm signal generation when changing the pwm pulse width to a new, much larger value. 15.5.8 buffered pwm signal generation channels 0 and 1 can be linked to form a buffered pwm channel whose output appears on the tch0 pin. the tim channel registers of the linked pair alternately control the pulse width of the output. setting the ms0b bit in tim channel 0 status and control register (tsc0) links channel 0 and channel 1. the tim channel 0 registers initially control the pulse width on the tch0 pin. writing to the tim channel 1 registers enables the tim channel 1 registers to synchronously control the pulse width at the beginning of the next pwm period. at each subsequent overflow, the tim channel registers (0 or 1) that control the pulse width are the ones written to last. tsc0 controls and monitors the buffered pwm function, and tim channel 1 status and control register (tsc1) is unused. note: in buffered pwm signal generation, do not write new pulse width values to the currently active channel registers. writing to the active channel registers is the same as generating unbuffered pwm signals.
timer interface module (tim) functional description MC68HC908RF2 ? rev. 1 advance information motorola timer interface module (tim) 207 15.5.9 pwm initialization to ensure correct operation when generating unbuffered or buffered pwm signals, use this initialization procedure: 1. in the tim status and control register (tsc): a. stop the tim counter by setting the tim stop bit, tstop. b. reset the tim counter by setting the tim reset bit, trst. 2. in the tim counter modulo registers (tmodh and tmodl), write the value for the required pwm period. 3. in the tim channel x registers (tchxh and tchxl), write the value for the required pulse width. 4. in tim channel x status and control register (tscx): a. write 0:1 (for unbuffered output compare or pwm signals) or 1:0 (for buffered output compare or pwm signals) to the mode select bits, msxb and msxa. see table 15-3 . b. write 1 to the toggle-on-overflow bit, tovx. c. write 1:0 (to clear output on compare) or 1:1 (to set output on compare) to the edge/level select bits, elsxb and elsxa. the output action on compare must force the output to the complement of the pulse width level. see table 15-3 . note: in pwm signal generation, do not program the pwm channel to toggle on output compare. toggling on output compare prevents reliable 0 percent duty cycle generation and removes the ability of the channel to self-correct in the event of software error or noise. toggling on output compare can also cause incorrect pwm signal generation when changing the pwm pulse width to a new, much larger value. 5. in the tim status control register (tsc), clear the tim stop bit, tstop. setting ms0b links channels 0 and 1 and configures them for buffered pwm operation. the tim channel 0 registers (tch0h and tch0l) initially control the buffered pwm output. tim status control register 0 (tscr0) controls and monitors the pwm signal from the linked channels.
advance information MC68HC908RF2 ? rev. 1 208 timer interface module (tim) motorola timer interface module (tim) clearing the toggle-on-overflow bit, tovx, inhibits output toggles on tim overflows. subsequent output compares try to force the output to a state it is already in and have no effect. the result is a 0 percent duty cycle output. setting the channel x maximum duty cycle bit (chxmax) and clearing the tovx bit generates a 100 percent duty cycle output. see 15.9.4 tim channel status and control registers . 15.6 interrupts these tim sources can generate interrupt requests:  tim overflow flag (tof) ? the timer counter value changes on the falling edge of the internal bus clock. the timer overflow flag (tof) bit is set on the falling edge of the internal bus clock following the timer rollover to $0000. the tim overflow interrupt enable bit, toie, enables tim overflow interrupt requests. tof and toie are in the tim status and control registers.  tim channel flag (ch0f) ? the ch0f bit is set when an input capture or output compare occurs on channel. channel tim cpu interrupt requests are controlled by the channel interrupt enable bit, ch1ie. 15.6.1 low-power modes the wait and stop instructions put the mcu in low power- consumption standby modes. 15.6.2 wait mode the tim remains active after the execution of a wait instruction. in wait mode, the tim registers are not accessible by the cpu. any enabled cpu interrupt request from the tim can bring the mcu out of wait mode. if tim functions are not required during wait mode, reduce power consumption by stopping the tim before executing the wait instruction.
timer interface module (tim) tim during break interrupts MC68HC908RF2 ? rev. 1 advance information motorola timer interface module (tim) 209 15.6.3 stop mode the tim is inactive after the execution of a stop instruction. the stop instruction does not affect register conditions or the state of the tim counter. tim operation resumes when the mcu exits stop mode after an external interrupt. 15.7 tim during break interrupts a break interrupt stops the tim counter. the system integration module (sim) controls whether status bits in other modules can be cleared during the break state. the bcfe bit in the sim break flag control register (sbfcr) enables software to clear status bits during the break state. see 6.8.3 sim break flag control register . to allow software to clear status bits during a break interrupt, write a logic 1 to the bcfe bit. if a status bit is cleared during the break state, it remains cleared when the mcu exits the break state. to protect status bits during the break state, write a logic 0 to the bcfe bit. with bcfe at logic 0 (its default state), software can read and write i/o registers during the break state without affecting status bits. some status bits have a 2-step read/write clearing procedure. if software does the first step on such a bit before the break, the bit cannot change during the break state as long as bcfe is at logic 0. after the break, doing the second step clears the status bit. 15.8 i/o signals port b shares two of its pins with the tim. tclk can be used as an external clock input to the tim prescaler and the tim channel 0 i/o pin ptb2/tch0.
advance information MC68HC908RF2 ? rev. 1 210 timer interface module (tim) motorola timer interface module (tim) 15.8.1 tim clock pin (tclk) tclk is an external clock input that can be the clock source for the tim counter instead of the prescaled internal bus clock. select the tclk input by writing logic 1s to the three prescaler select bits, ps2 ? ps0. see 15.9.1 tim status and control register . the minimum tclk pulse width, tclk lmin or tclk hmin , is: the maximum tclk frequency is: bus frequency 2 refer to 17.10 control timing . tclk is available as a general-purpose i/o pin when not used as the tim clock input. when the tclk pin is the tim clock input, it is an input regardless of the state of the ddrb3 bit in data direction register b. 15.8.2 tim channel i/o pins (tch0) the channel i/o pins are programmable independently as an input capture pin or an output compare pin. tch0 can be configured as buffered output compare or buffered pwm pins. 15.9 i/o registers these i/o registers control and monitor operation of the tim:  tim status and control register, tsc  tim control registers, tcnth and tcntl  tim counter modulo registers, tmodh and tmodl  tim channel status and control registers, tsc0 and tsc1  tim channel registers, tch0h, tch0l, tch1h, and tch1l 1 + t su bus frequency
timer interface module (tim) i/o registers MC68HC908RF2 ? rev. 1 advance information motorola timer interface module (tim) 211 15.9.1 tim status and control register the tim status and control register (tsc):  enables tim overflow interrupts  flags tim overflows  stops the tim counter  resets the tim counter  prescales the tim counter clock tof ? tim overflow flag bit this read/write flag is set when the tim counter resets to $0000 after reaching the modulo value programmed in the tim counter modulo registers. clear tof by reading the tim status and control register when tof is set and then writing a logic 0 to tof. if another tim overflow occurs before the clearing sequence is complete, then writing logic 0 to tof has no effect. therefore, a tof interrupt request cannot be lost due to inadvertent clearing of tof. reset clears the tof bit. writing a logic 1 to tof has no effect. 1 = tim counter has reached modulo value. 0 = tim counter has not reached modulo value. toie ? tim overflow interrupt enable bit this read/write bit enables tim overflow interrupts when the tof bit becomes set. reset clears the toie bit. 1 = tim overflow interrupts enabled 0 = tim overflow interrupts disabled address: $0020 bit 7654321bit 0 read: tof toie tstop 00 ps2 ps1 ps0 write: 0 trst reset:00100000 = unimplemented figure 15-4. tim status and control register (tsc)
advance information MC68HC908RF2 ? rev. 1 212 timer interface module (tim) motorola timer interface module (tim) tstop ? tim stop bit this read/write bit stops the tim counter. counting resumes when tstop is cleared. reset sets the tstop bit, stopping the tim counter until software clears the tstop bit. 1 = tim counter stopped 0 = tim counter active note: do not set the tstop bit before entering wait mode if the tim is required to exit wait mode. trst ? tim reset bit setting this write-only bit resets the tim counter and the tim prescaler. setting trst has no effect on any other registers. counting resumes from $0000. trst is cleared automatically after the tim counter is reset and always reads as logic 0. reset clears the trst bit. 1 = prescaler and tim counter cleared 0 = no effect note: setting the tstop and trst bits simultaneously stops the tim counter at a value of $0000. ps2 ? ps0 ? prescaler select bits these read/write bits select either the tclk pin or one of the seven prescaler outputs as the input to the tim counter as table 15-2 shows. reset clears the ps2 ? ps0 bits. table 15-2. prescaler selection ps2 ? ps0 tim clock source 000 internal bus clock 1 001 internal bus clock 2 010 internal bus clock 4 011 internal bus clock 8 100 internal bus clock 16 101 internal bus clock 32 110 internal bus clock 64 111 tclk
timer interface module (tim) i/o registers MC68HC908RF2 ? rev. 1 advance information motorola timer interface module (tim) 213 15.9.2 tim counter registers the two read-only tim counter registers contain the high and low bytes of the value in the tim counter. reading the high byte (tcnth) latches the contents of the low byte (tcntl) into a buffer. subsequent reads of tcnth do not affect the latched tcntl value until tcntl is read. reset clears the tim counter registers. setting the tim reset bit (trst) also clears the tim counter registers note: if you read tcnth during a break interrupt, be sure to unlatch tcntl by reading tcntl before exiting the break interrupt. otherwise, tcntl retains the value latched during the break. register name and address: tcnth ? $0021 bit 7654321bit 0 read: bit 15 14 13 12 11 10 9 bit 8 write: reset: 00000000 register name and address: tcntl ? $0022 bit 7654321bit 0 read: bit 7654321bit 0 write: reset: 00000000 = unimplemented figure 15-5. tim counter registers (tcnth and tcntl)
advance information MC68HC908RF2 ? rev. 1 214 timer interface module (tim) motorola timer interface module (tim) 15.9.3 tim counter modulo registers the read/write tim modulo registers contain the modulo value for the tim counter. when the tim counter reaches the modulo value, the overflow flag (tof) becomes set, and the tim counter resumes counting from $0000 at the next clock. writing to the high byte (tmodh) inhibits the tof bit and overflow interrupts until the low byte (tmodl) is written. reset sets the tim counter modulo registers. note: reset the tim counter before writing to the tim counter modulo registers. 15.9.4 tim channel status and control registers each of the tim channel status and control registers (tsc0 and tsc1):  flags input captures and output compares  enables input capture and output compare interrupts  selects input capture, output compare, or pwm operation  selects high, low, or toggling output on output compare  selects rising edge, falling edge, or any edge as the active input capture trigger  selects output toggling on tim overflow  selects 100 percent pwm duty cycle  selects buffered or unbuffered output compare/pwm operation register name and address: tmodh ? $0023 bit 7654321bit 0 read: bit 15 14 13 12 11 10 9 bit 8 write: reset: 11111111 register name and address: tmodl ? $0024 bit 7654321bit 0 read: bit 7654321bit 0 write: reset: 11111111 figure 15-6. tim counter modulo registers (tmodh and tmodl)
timer interface module (tim) i/o registers MC68HC908RF2 ? rev. 1 advance information motorola timer interface module (tim) 215 chxf ? channel x flag bit when channel x is an input capture channel, this read/write bit is set when an active edge occurs on the channel x pin. when channel x is an output compare channel, chxf is set when the value in the tim counter registers matches the value in the tim channel x registers. when tim cpu interrupt requests are enabled (chxie = 1), clear chxf by reading tim channel x status and control register with chxf set and then writing a logic 0 to chxf. if another interrupt request occurs before the clearing sequence is complete, then writing logic 0 to chxf has no effect. therefore, an interrupt request cannot be lost due to inadvertent clearing of chxf. reset clears the chxf bit. writing a logic 1 to chxf has no effect. 1 = input capture or output compare on channel x 0 = no input capture or output compare on channel x chxie ? channel x interrupt enable bit this read/write bit enables tim cpu interrupts on channel x. reset clears the chxie bit. 1 = channel x cpu interrupt requests enabled 0 = channel x cpu interrupt requests disabled register name and address: tsc0 ? $0025 bit 7654321bit 0 read: ch0f ch0ie ms0b ms0a els0b els0a tov0 ch0max write: 0 reset:00000000 register name and address: tsc1 ? $0028 bit 7654321bit 0 read: ch1f ch1ie 0 ms1a els1b els1a tov1 ch1max write: 0 reset:00000000 = unimplemented figure 15-7. tim channel status and control registers (tsc0 and tsc1)
advance information MC68HC908RF2 ? rev. 1 216 timer interface module (tim) motorola timer interface module (tim) msxb ? mode select bit b this read/write bit selects buffered output compare/pwm operation. msxb exists only in the tim channel 0 and tim channel 1 status and control registers. setting ms0b disables the tim channel 1 status and control register. reset clears the msxb bit. 1 = buffered output compare/pwm operation enabled 0 = buffered output compare/pwm operation disabled msxa ? mode select bit a when elsxb:a 00, this read/write bit selects either input capture operation or unbuffered output compare/pwm operation. see table 15-3 . 1 = unbuffered output compare/pwm operation 0 = input capture operation when elsxb:a = 00, this read/write bit selects the initial output level of the tch0 pin. see table 15-3 . reset clears the msxa bit. 1 = initial output level low 0 = initial output level high note: before changing a channel function by writing to the msxb or msxa bit, set the tstop and trst bits in the tim status and control register (tsc). elsxb and elsxa ? edge/level select bits when channel 0 is an input capture channel, these read/write bits control the active edge-sensing logic on channel x. when channel x is an output compare channel, elsxb and elsxa control the channel x output behavior when an output compare occurs. when elsxb and elsxa are both clear, channel x is not connected to port b, and pin ptb0/tch0 is available as a general-purpose i/o pin. table 15-3 shows how elsxb and elsxa work. reset clears the elsxb and elsxa bits. note: tim channel 1 does not have an external pin associated with it.
timer interface module (tim) i/o registers MC68HC908RF2 ? rev. 1 advance information motorola timer interface module (tim) 217 note: before enabling a tim channel register for input capture operation, make sure that the ptb/tch0 pin is stable for at least two bus clocks. tovx ? toggle on overflow bit when channel 0 is an output compare channel, this read/write bit controls the behavior of the channel 0 output when the tim counter overflows. when channel 0 is an input capture channel, tov0 has no effect. reset clears the tov0 bit. 1 = channel x pin toggles on tim counter overflow. 0 = channel x pin does not toggle on tim counter overflow. note: the state of tov1 has no effect since there is no pin. when tovx is set, a tim counter overflow takes precedence over a channel x output compare if both occur at the same time. channel 1 should not be configured in input capture mode. warning: the user must configure tim channel 1 in a mode other than input capture. it is recommended that this procedure be part of the initialization of the system after reset. table 15-3. mode, edge, and level selection msxb:msxa elsxb:elsxa mode configuration x0 00 output preset pin under port control; initial output level high x1 00 pin under port control; initial output level low 00 01 input capture capture on rising edge only 00 10 capture on falling edge only 00 11 capture on rising or falling edge 01 01 output compare or pwm toggle output on compare 01 10 clear output on compare 01 11 set output on compare 1x 01 buffered output compare or buffered pwm toggle output on compare 1x 10 clear output on compare 1x 11 set output on compare
advance information MC68HC908RF2 ? rev. 1 218 timer interface module (tim) motorola timer interface module (tim) &+[0$;2&kdqqho[0d[lpxp'xw\&\foh%lw when the tovx bit is at logic 1 and clear output on compare is selected, setting the chxmax bit forces the duty cycle of buffered and unbuffered pwm signals to 100 percent. as figure 15-8 shows, the chxmax bit takes effect in the cycle after it is set or cleared. the output stays at 100 percent duty cycle level until the cycle after chxmax is cleared. note: the pwm 0 percent duty cycle is defined as output low all of the time. to generate the 0 percent duty cycle, select clear output on compare and then clear the tovx bit (chxmax = 0). the pwm 100 percent duty cycle is defined as output high all of the time. to generate the 100 percent duty cycle, use the chxmax bit in the tscx register. figure 15-8. chxmax latency 15.9.5 tim channel registers these read/write registers contain the captured tim counter value of the input capture function or the output compare value of the output compare function. the state of the tim channel registers after reset is unknown. in input capture mode (msxb:msxa = 0:0), reading the high byte of the tim channel x registers (tchxh) inhibits input captures until the low byte (tchxl) is read. output overflow ptbx/tchx period chxmax overflow overflow overflow overflow compare output compare output compare output compare
timer interface module (tim) i/o registers MC68HC908RF2 ? rev. 1 advance information motorola timer interface module (tim) 219 in output compare mode (msxb:msxa 0:0), writing to the high byte of the tim channel x registers (tchxh) inhibits output compares until the low byte (tchxl) is written. register name and address: tch0h ? $0026 bit 7654321bit 0 read: bit 15 14 13 12 11 10 9 bit 8 write: reset: indeterminate after reset register name and address: tch0l ? $0027 bit 7654321bit 0 read: bit 7654321bit 0 write: reset: indeterminate after reset figure 15-9. tim channel 0 registers (tch0h and tch0l) register name and address: tch1h ? $0029 bit 7654321bit 0 read: bit 15 14 13 12 11 10 9 bit 8 write: reset: indeterminate after reset register name and address: tch1l ? $002a bit 7654321bit 0 read: bit 7654321bit 0 write: reset: indeterminate after reset figure 15-10. tim channel 1 registers (tch1h and tch1l)
advance information MC68HC908RF2 ? rev. 1 220 timer interface module (tim) motorola timer interface module (tim)
MC68HC908RF2 ? rev. 1 advance information motorola pll tuned uhf transmitter module 221 advance information ? MC68HC908RF2 section 16. pll tuned uhf transmitter module 16.1 contents 16.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .222 16.3 transmitter functional description . . . . . . . . . . . . . . . . . . . . .223 16.4 phase-lock loop (pll) and local oscillator . . . . . . . . . . . . .223 16.5 rf output stage. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .224 16.6 modulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .224 16.7 microcontroller interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . .225 16.8 state machine. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .225 16.9 power management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .228 16.10 data clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228 16.11 application information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .229 16.11.1 application schematics in ook and fsk modulation . . . . . . . . . . . . . . . . . . . . . . . . . . .229 16.11.2 complete application schematic . . . . . . . . . . . . . . . . . . . .232
advance information MC68HC908RF2 ? rev. 1 222 pll tuned uhf transmitter module motorola pll tuned uhf transmitter module 16.2 introduction this section describes the integrated radio frequency (rf) module. this module integrates an ultra high frequency (uhf) transmitter offering these key features:  switchable frequency bands: 315, 434, and 868 mhz  on/off keying (ook) and frequency shift keying (fsk) modulation  adjustable output power range  fully integrated voltage-controlled oscillator (vco)  supply voltage range: 1.9 to 3.7 v  very low standby current: 0.5 na @ t a = 25 c  low supply voltage shutdown  data clock output for microcontroller  low external component count architecture of the module is described in figure 16-1 . figure 16-1. simplified integrated rf module block diagram vco first order pfd 32 2 pa xco 64 control driver enable enable_fsk data_ook data_fsk cfsk xtal0 xtal1 mode data enable v cc gnd band r ext gndrf rfout dataclk
pll tuned uhf transmitter module transmitter functional description MC68HC908RF2 ? rev. 1 advance information motorola pll tuned uhf transmitter module 223 16.3 transmitter functional description the transmitter is a phase-locked loop (pll) tuned low-power uhf transmitter. the different modes of operation are controlled by the microcontroller through several digital input pins. the power supply voltage ranges from 1.9 v to 3.7 v allowing operation with a single lithium cell. 16.4 phase-lock loop (pll) and local oscillator the vco is a completely integrated relaxation oscillator. the phase frequency detector (pfd) and the loop filter are fully integrated.the exact output frequency is equal to: f rfout = f xtal x pll divider ratio the frequency band of operation is selected through the band pin. table table 16-1 provides details for each frequency band selection. an out-of-lock function is performed by monitoring the internal pfd output voltage. when it exceeds its limits, the rf output stage is disabled. table 16-1. frequency band selection and associated divider ratios band input level frequency band (mhz) pll divider ratio crystal oscillator frequency (mhz) high 315 32 9.84 434 13.56 low 868 64
advance information MC68HC908RF2 ? rev. 1 224 pll tuned uhf transmitter module motorola pll tuned uhf transmitter module 16.5 rf output stage the output stage is a single-ended square wave switched current source. harmonics will be present in the output current drive. their radiated absolute level depends on the antenna characteristics and output power. typical application demonstrates compliance to european telecommunications standards institute (etsi) standard. a resistor r ext connected to the rext pin controls the output power allowing a tradeoff between radiated power and current consumption. the output voltage is internally clamped to v cc 2 v be (typically v cc 1.5 v @ t a = 25 c). 16.6 modulation if a low-logic level is applied on pin mode, then the on/off keying (ook) modulation is selected. this modulation is performed by switching on/off the rf output stage. the logic level applied on pin data controls the output stage state: data = 0 output stage off data = 1 output stage on if a high-logic level is applied on pin mode, then frequency shift keying (fsk) modulation is selected. this modulation is achieved by modulating the frequency of the reference oscillator. this frequency change is performed by switching the external crystal load capacitor. the logic level applied on pin data controls the internal switch connected to pin cfsk: data = 0 switch off data = 1 switch on in case of figure 16-5 , where the two capacitors c6 and c9 are in series: data = 0 leads to the high value of the carrier frequency data = 1 leads to the low value of the carrier frequency
pll tuned uhf transmitter module microcontroller interfaces MC68HC908RF2 ? rev. 1 advance information motorola pll tuned uhf transmitter module 225 this crystal pulling solution implies that the rf output frequency deviation equals the crystal frequency deviation multipled by the pll divider ratio (see table 16-1 ). 16.7 microcontroller interfaces four digital input pins (enable, data, band, and mode) enable the circuit to be controlled by a microcontroller. it is recommended to configure the band frequency and the modulation type before enabling the circuit. in a typical application the input pins band and mode are hardwired. one digital output (dataclk) provides the microcontroller a reference frequency for data clocking. this frequency is equal to the crystal oscillator frequency divided by 64 (see table 16-2 ). 16.8 state machine figure 16-2 details the main state machine. table 16-2. dataclk frequency versus crystal oscillator frequency crystal oscillator frequency (mhz) dataclk frequency (khz) 9.84 154 13.56 212
advance information MC68HC908RF2 ? rev. 1 226 pll tuned uhf transmitter module motorola pll tuned uhf transmitter module figure 16-2. main state machine enable = 1 state 3 pll acquisition, ready to transmit state 2 pll enabled but out of lock-in range state 1 standby mode enable = 0 power on and enable = 0 state 4 transmission mode state 6 shutdown mode state 5 pll out of lock-in range pll in lock-in range pll out of lock-in range enable = 0 v battery < v shutdoown data pll in lock-in range pll out of lock-in range
pll tuned uhf transmitter module state machine MC68HC908RF2 ? rev. 1 advance information motorola pll tuned uhf transmitter module 227 state 1 the circuit is in standby mode and draws only a leakage current from the power supply. state 2 in this state, t kh pll is enabled but out of the lock-in range. therefore the rf output stage is switched off preventing any data transmission. d dwdforfnlvdydlodeohrqslq'$7$&/. in normal operation, this state is transitional. state 3 in this state, the pll is within the lock-in range. if t < t pll_lock_in , then the pll can still be in acquisition mode. if t t pll_lock_in , then the pll is locked. the circuit is ready to transmit in band and is waiting for the first data (see figure 16-3 ). state 4 a rising edge on pin data starts the transmission. data entered on pin data are output on pin rfout. the modulation is the one selected through the level applied on pin mode. state 5 an out-of-lock condition has been detected. the rf output stage is switched off preventing any data transmission. d dwdforfnlvdyd lodeoh rqslq'$7$&/. state 6 when the supply voltage falls below the shutdown voltage threshold (v sdwn ) the whole circuit is switched off. applying a low level on pin enable is the only condition to get out of this state. figure 16-3 shows the waveforms of the main signals for a typical application cycle
advance information MC68HC908RF2 ? rev. 1 228 pll tuned uhf transmitter module motorola pll tuned uhf transmitter module figure 16-3. signals, waveforms, and timing definitions 16.9 power management when the battery voltage falls below the shutdown voltage threshold (v sdwn ) the whole circuit is switched off. note: after this shutdown, the circuit is latched until a low level is applied on pin enable (see state 6 under 16.8 state machine ). 16.10 data clock when the data clock starts, the high-to-low ratio may be uneven. similarly the clock is switched off asynchronously so the last period length is not guaranteed. enable dataclk data rfout state 1 state 2 state 4 state 3 mode = 0, ook modulation mode = 1, fsk modulation state 1 f carrier f carrier f carrier2 f carrier1 f carrier2 f carrier1 t pll_lock_in t dataclk_settling see note note: pll locked, circuit ready to tramsmit in band.
pll tuned uhf transmitter module application information MC68HC908RF2 ? rev. 1 advance information motorola pll tuned uhf transmitter module 229 16.11 application information this subsection provides application information for the usage of the uhf transmitter module. 16.11.1 application schematics in ook and fsk modulation figure 16-4 and figure 16-5 show application schematics in ook and fsk modulation for the 315-mhz and 434-mhz frequency bands. for 868-mhz band application, the input pin band must be wired to gnd. see component description in table 16-4 and table 16-5 . figure 16-4. application schematic in ook modulation, 315-mhz and 434-mhz frequency bands dataclk data band gnd xtal1 xtal0 r ext mode enable v cc gndrf rfout v cc cfsk to mcu v cc c6 y1 r2 nc c7 c8 v cc nc = no connection matching network antenna
advance information MC68HC908RF2 ? rev. 1 230 pll tuned uhf transmitter module motorola pll tuned uhf transmitter module figure 16-5. application schematic in fsk modulation, 315-mhz and 434-mhz frequency bands dataclk data band gnd xtal1 xtal0 r ext mode enable v cc gndrf rfout v cc cfsk to mcu v cc y1 r2 c7 c8 matching network antenna v cc c6 c9 table 16-3. component description component function value unit y1 crystal 315-mhz band: 9.84, see table 16-5 mhz 434-mhz band: 13.56, see table 16-5 mhz 868-mhz band: 13.56, see table 16-5 mhz r2 rf output level setting resistor (r ext ) 12 k ? c6 crystal load capacitor ook modulation: 18 pf fsk modulation: 22 pf c7 power supply decoupling capacitor 10 nf c8 100 pf c9 crystal pulling capacitor for fsk modulation only see table 16-5 pf
pll tuned uhf transmitter module application information MC68HC908RF2 ? rev. 1 advance information motorola pll tuned uhf transmitter module 231 a example of crystal reference is: tokyo denpa tts-3b 13568.750 khz, see table 16-4 . table 16-4. recommended crystal characteristics (smd ceramic package) parameter value unit load capacitance 20 pf motional capacitance 6.7 ff static capacitance 2 pf loss resistance 40 w table 16-5. crystal pulling capacitor value versus carrier frequency total deviation carrier frequency (mhz) carrier frequency total deviation (khz) capacitor value (pf) 434 40 18 70 10 100 6.8 868 80 18 140 10 200 6.8
advance information MC68HC908RF2 ? rev. 1 232 pll tuned uhf transmitter module motorola pll tuned uhf transmitter module 16.11.2 complete application schematic figure 16-6 gives a complete application schematic using the motorola MC68HC908RF2. 22.prgxodwlrqlvvhohfwhgi &duulhu 0+] figure 16-6. complete application schematic in ook modulation, 434-mhz frequency band xtal0 xtal1 gnd ptb2/tch0 ptb1 ptb0/mclk pta0 pta1/kbd1 MC68HC908RF2 2 3 4 5 6 7 8 1 32 31 30 29 28 27 26 25 9 10 11 12 13 14 15 16 24 23 22 21 20 19 18 17 y1 c10 18 pf 13.56 mhz r2 12 k c9 2.2 pf c5 100 pf v batt c3 10 nf sw1 sw2 osc2 v dd v ss osc1 ptb3/tclk dataclk data band pta7 rst irq1 pta4/kbd4 pta3/kbd3 pta5/kbd5 pta6/kbd6 pta2/kbd2 rext cfsk v cc rfout gnddrf v cc enable mode enable enable v batt c6 10 nf data data v batt
MC68HC908RF2 ? rev. 1 advance information motorola preliminary electrical specifications 233 advance information ? MC68HC908RF2 section 17. preliminary electrical specifications 17.1 contents 17.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .233 17.3 absolute maximum ratings . . . . . . . . . . . . . . . . . . . . . . . . . .234 17.4 functional operating range. . . . . . . . . . . . . . . . . . . . . . . . . .235 17.5 thermal characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . .235 17.6 1.8-volt to 3.3-volt dc electrical characteristics excluding uhf module . . . . . . . . . . . . . . . . . . . . . . . . . . . 236 17.7 3.0-volt dc electrical characteristics excluding uhf module . . . . . . . . . . . . . . . . . . . . . . . . . . . 237 17.8 2.0-volt dc electrical characteristics excluding uhf module . . . . . . . . . . . . . . . . . . . . . . . . . . . 238 17.9 uhf transmitter module . . . . . . . . . . . . . . . . . . . . . . . . . . . .239 17.9.1 uhf module electrical characteristics. . . . . . . . . . . . . . . . 239 17.9.2 uhf module output power measurement . . . . . . . . . . . . .244 17.10 control timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .246 17.11 internal oscillator characteristics . . . . . . . . . . . . . . . . . . . . . . 246 17.12 lvi characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247 17.13 memory characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . .248 17.2 introduction this section contains preliminary electrical and timing specifications. note: the timing specifications, electrical, and thermal characteristic values outlined in this section are design targets and have not yet been fully tested.
advance information MC68HC908RF2 ? rev. 1 234 preliminary electrical specifications motorola preliminary electrical specifications 17.3 absolute maximum ratings maximum ratings are the extreme limits to which the mcu can be exposed without permanently damaging it. note: this device is not guaranteed to operate properly at the maximum ratings. refer to 17.6 1.8-volt to 3.3-volt dc electrical characteristics excluding uhf module , 17.7 3.0-volt dc electrical characteristics excluding uhf module , 17.8 2.0-volt dc electrical characteristics excluding uhf module , and 17.9.1 uhf module electrical characteristics for guaranteed operating conditions. note: this device contains circuitry to protect the inputs against damage due to high static voltages or electric fields; however, it is advised that normal precautions be taken to avoid application of any voltage higher than maximum-rated voltages to this high-impedance circuit. for proper operation, it is recommended that v in and v out be constrained to the range v ss (v in or v out ) v dd . reliability of operation is enhanced if unused inputs are connected to an appropriate logic voltage level (for example, either v ss or v dd ). characteristic (1) 1. voltages referenced to v ss . symbol value unit supply voltage v dd ? 0.3 to +3.6 v input voltage v in v ss ? 0.3 to v dd +0.3 v esd hbm voltage capability on each pin (2) 2. human body model, aec-q100-002 rev. c ? 2000 v esd mm voltage capability on each pin (3) 3. machine model, aec-q100-003 rev. d ? 150 v maximum current per pin excluding v dd , v ss , pta7 ? pta0, and uhf module pins i 15 ma maximum current for pins pta7 ? pta0 i pta7 ? i pta0 25 ma maximum current out of v ss i mvss 100 ma maximum current into v dd i mvdd 100 ma storage temperature t stg ? 55 to +150 c
preliminary electrical specifications functional operating range MC68HC908RF2 ? rev. 1 advance information motorola preliminary electrical specifications 235 17.4 functional operating range 17.5 thermal characteristics characteristic symbol min max unit operating temperature range (1) 1. extended temperature range to be determined t a ? 40 85 c operating voltage range v dd 1.8 3.6 v characteristic symbol value unit thermal resistance lqfp (32 pin) ja tbd c/w i/o pin power dissipation p i/o user determined w power dissipation (1) 1. power dissipation is a function of temperature. p d p d = (i dd x v dd ) + p i/o = k/(t j + 273 c) w constant (2) 2. k is a constant unique to the device. k can be determined for a known t a and measured p d. with this value of k, p d and t j can be determined for any value of t a . k p d x (t a + 273 c) + p d 2 x ja w/ c average junction temperature t j t a + (p d x ja ) c maximum junction temperature t jm 100 c
advance information MC68HC908RF2 ? rev. 1 236 preliminary electrical specifications motorola preliminary electrical specifications 17.6 1.8-volt to 3.3-volt dc electrical characteristics excluding uhf module characteristic (1) 1. parameters are design targets at v dd = 1.8 v to 3.3 v, v ss = 0 vdc, t a = ? 40 o c to +85 o c, unless otherwise noted symbol min typ (2) 2. typical values reflect average measurements at midpoint of voltage range, 25 c only. max unit output high voltage (i load = ? 1.2 ma) (i load = ? 2.0 ma) v oh v dd ? 0.3 v dd ? 1.0 ? ? ? ? v output low voltage (i load = 1.2 ma) (i load = 3.0 ma) (i load = 3.0 ma) pta7 ? pta0 only v ol ? ? ? ? ? ? 0.3 1.0 0.3 v input high voltage, all ports, irq1 , osc1 v ih 0.7 x v dd ? v dd + 0.3 v input low voltage, all ports, irq1 , osc1 v il v ss ? 0.3 x v dd v v dd supply current run (3) (f op = 2.0 mhz) wait (4) (f op = 2.0 mhz) stop (5) 25 c ? 40 c to 85 c 25 c with lvi enabled ? 40 c to 85 c with lvi enabled 3. run (operating) i dd measured using internal clock generator module (f op = 2.0 mhz). v dd = 3.3 vdc. all inputs 0.2 v from rail. no dc loads. less than 100 pf on all outputs. all ports configured as inputs. c l = 20 pf. osc2 capacitance linearly affects run i dd . measured with all modules enabled. 4. wait i dd measured using internal clock generator module, f op = 2.0 mhz. all inputs 0.2 v from rail; no dc loads; less than 100 pf on all outputs. c l = 20 pf. osc2 capacitance linearly affects wait i dd . all ports configured as inputs. 5. stop i dd measured with no port pins sourcing current, all modules disabled except as noted. i dd ? ? ? ? ? ? ? ? 10 ? 50 ? 4.3 1.2 ? 100 ? 350 ma ma na na a a i/o ports high-impedance leakage current (6) 6. pullups and pulldowns are disabled. i il ?? 1 a input current i in ?? 1 a capacitance ports (as input or output) c out c in ? ? ? ? 12 8 pf por re-arm voltage (7) 7. maximum is highest voltage that por is guaranteed. v por 0 ? 200 mv por reset voltage (8) 8. maximum is highest voltage that por is possible. v por 0 700 800 mv por rise time ramp rate (9) 9. if minimum v dd is not reached before the internal por reset is released, rst must be driven low externally until minimum v dd is reached. r por 0.02 ?? v/ms monitor mode entry voltage v hi v dd + 2.5 ? 8v pullup resistor, pta6 ? pta1, irq1 r pu 50 80 120 k ?
preliminary electrical specifications 3.0-volt dc electrical characteristics excluding uhf module MC68HC908RF2 ? rev. 1 advance information motorola preliminary electrical specifications 237 17.7 3.0-volt dc electrical characteristics excluding uhf module characteristic (1) 1. parameters are design targets at v dd = 3.0 10%, v ss = 0 vdc, t a = ? 40 o c to +85 o c, unless otherwise noted symbol min typ (2) 2. typical values reflect average measurements at midpoint of voltage range, 25 c only. max unit output high voltage (i load = ? 2.0 ma) (i load = ? 8.0 ma) v oh v dd ? 0.3 v dd ? 1.0 ? ? ? ? v output low voltage (i load = 2.0 ma) (i load = 6.5 ma) (i load = 5.0 ma) pta7 ? pta0 only v ol ? ? ? ? ? ? 0.3 1.0 0.3 v input high voltage, all ports, irq1 , osc1 v ih 0.7 x v dd ? v dd + 0.3 v input low voltage, all ports, irq1 , osc1 v il v ss ? 0.3 x v dd v v dd supply current run (3) (f op = 4.0 mhz) wait (4) (f op = 4.0 mhz) stop (5) 25 c ? 40 c to 85 c 25 c with lvi enabled ? 40 c to 85 c with lvi enabled 3. run (operating) i dd measured using internal clock generator module (f op = 4.0 mhz). v dd = 3.3 vdc. all inputs 0.2 v from rail. no dc loads. less than 100 pf on all outputs. all ports configured as inputs. c l = 20 pf. osc2 capacitance linearly affects run i dd . measured with all modules enabled. 4. wait i dd measured using internal clock generator module, f op = 4.0 mhz. all inputs 0.2 v from rail; no dc loads; less than 100 pf on all outputs. c l = 20 pf. osc2 capacitance linearly affects wait i dd . all ports configured as inputs. 5. stop i dd measured with no port pins sourcing current, all modules disabled except as noted. i dd ? ? ? ? ? ? ? ? 10 ? 50 ? 8.6 1.2 ? 100 ? 350 ma ma na na a a i/o ports high-impedance leakage current (6) 6. pullups and pulldowns are disabled. i il ?? 1 a input current i in ?? 1 a capacitance ports (as input or output) c out c in ? ? ? ? 12 8 pf por re-arm voltage (7) 7. maximum is highest voltage that por is guaranteed. v por 0 ? 200 mv por reset voltage (8) 8. maximum is highest voltage that por is possible. v por 0 700 800 mv por rise time ramp rate (9) 9. if minimum v dd is not reached before the internal por reset is released, rst must be driven low externally until minimum v dd is reached. r por 0.02 ?? v/ms monitor mode entry voltage v hi v dd + 2.5 ? 8v pullup resistor, pta6 ? pta1, irq1 r pu 50 80 120 k ?
advance information MC68HC908RF2 ? rev. 1 238 preliminary electrical specifications motorola preliminary electrical specifications 17.8 2.0-volt dc electrical characteristics excluding uhf module characteristic (1) 1. parameters are design targets at v dd = 2.0 10%, v ss = 0 vdc, t a = ? 40 o c to +85 o c, unless otherwise noted symbol min typ (2) 2. typical values reflect average measurements at midpoint of voltage range, 25 c only. max unit output high voltage (i load = ? 1.2 ma) (i load = ? 2.0 ma) v oh v dd ? 0.3 v dd ? 1.0 ? ? ? ? v output low voltage (i load = 1.2 ma) (i load = 3.0 ma) (i load = 3.0 ma) pta7 ? pta0 only v ol ? ? ? ? ? ? 0.3 1.0 0.3 v input high voltage, all ports, irq1 , osc1 v ih 0.7 x v dd ? v dd + 0.3 v input low voltage, all ports, irq1 , osc1 v il v ss ? 0.3 x v dd v v dd supply current run (3) (f op = 2.0 mhz) wait (4) (f op = 2.0 mhz) stop (5) 25 c ? 40 c to 85 c 25 c with lvi enabled ? 40 c to 85 c with lvi enabled 3. run (operating) i dd measured using internal clock generator module (f op = 2.0 mhz). v dd = 2.0 vdc. all inputs 0.2 v from rail. no dc loads. less than 100 pf on all outputs. all ports configured as inputs. c l = 20 pf. osc2 capacitance linearly affects run i dd . measured with all modules enabled. 4. wait i dd measured using internal clock generator module, f op = 2.0 mhz. all inputs 0.2 v from rail; no dc loads; less than 100 pf on all outputs. c l = 20 pf. osc2 capacitance linearly affects wait i dd . all ports configured as inputs. 5. stop i dd measured with no port pins sourcing current, all modules disabled except as noted. i dd ? ? ? ? ? ? ? ? 10 ? 50 ? 2.5 850 ? 100 ? 350 ma a na na a a i/o ports high-impedance leakage current (6) 6. pullups and pulldowns are disabled. i il ?? 1 a input current i in ?? 1 a capacitance ports (as input or output) c out c in ? ? ? ? 12 8 pf por re-arm voltage (7) 7. maximum is highest voltage that por is guaranteed. v por 0 ? 200 mv por reset voltage (8) 8. maximum is highest voltage that por is possible. v por 0 700 800 mv por rise time ramp rate (9) 9. if minimum v dd is not reached before the internal por reset is released, rst must be driven low externally until minimum v dd is reached. r por 0.02 ?? v/ms monitor mode entry voltage v hi v dd + 2.5 ? 8v pullup resistor, pta6 ? pta1, irq1 r pu 50 80 120 k ?
preliminary electrical specifications uhf transmitter module MC68HC908RF2 ? rev. 1 advance information motorola preliminary electrical specifications 239 17.9 uhf transmitter module this subsection provides electrical specifications and timing definitions for the uhf transmitter module. 17.9.1 uhf module electrical characteristics unless otherwise specified:  v cc = 3 v  r ext = 12 k ?  operating temperature range (t a ) = ? 40 c to 85 c  rf output frequency: f carrier = 433.92 mhz  reference frequency: f reference =13.56 mhz  ook modulation selected  output load is 50 ? resistor (see figure 17-4 ) values refer to the circuit shown in the recommended application schematic (see figure 16-4. application schematic in ook modulation, 315-mhz and 434-mhz frequency bands ). typical values reflect average measurement at v cc = 3 v, t a = 25 c. note: electrical characteristics shown at 125 c are for information only. these values have not been tested.
advance information MC68HC908RF2 ? rev. 1 240 preliminary electrical specifications motorola preliminary electrical specifications parameter test conditions and comments min typ max unit general parameters supply current in standby mode t a 25 c ? 0.1 5 na t a = 60 c ? 730na t a = 85 c ? 40 100 na t a = 125 c ? 800 1700 na supply current in transmission mode 315 and 434 mhz bands, continuous wave, t a 85 c ? 11.6 13.5 ma 315 and 434 mhz bands, data = 0, ? 40 c t a 125 c ? 4.4 6.0 ma 868 mhz band, data = 0, ? 40 c t a 125 c ? 4.6 6.2 ma 315 and 434 mhz bands, continuous wave, ? 40 c t a 125 c ? 11.6 14.9 ma 868 mhz band, continuous wave, ? 40 c t a 125 c ? 11.8 15.1 ma supply voltage ? 33.7v shutdown voltage threshold t a = ? 40 c ? 2.04 2.11 v t a = ? 20 c ? 1.99 2.06 v t a = 25 c ? 1.86 1.95 v t a = 60 c ? 1.76 1.84 v t a = 85 c ? 1.68 1.78 v t a = 125 c ? 1.56 1.67 v rf parameters (assuming a 50 ? matching network connected to the d.u.t. output) r ext value 12 ? 21 k ? output power 315 and 434 mhz bands, with 50 ? matching network ? 5 ? dbm 868 mhz band, with 50 ? matching network ? 1 ? dbm 315 and 434 mhz bands, ? 40 c t a 125 c ? 30 3dbm 868 mhz band, ? 40 c t a 125 c ? 7 ? 30dbm ? continued ?
preliminary electrical specifications uhf transmitter module MC68HC908RF2 ? rev. 1 advance information motorola preliminary electrical specifications 241 current and output power variation vs r ext value 314 and 434 mhz bands, with 50 ? matching network ?? 0.35 ? db/k ? ma/k ? harmonic 2 level 315 and 434 mhz bands, with 50 ? matching network ?? 34 ? dbc 868 mhz band, with 50 ? matching network ?? 49 ? dbc 315 and 434 mhz bands ?? 23 ? 17 dbc 868 mhz band ?? 38 ? 27 dbc harmonic 3 level 315 and 434mhz bands, with 50 ? matching network ?? 32 ? dbc 868 mhz band, with 50 ? matching network ?? 57 ? dbc 315 and 434 mhz bands ?? 21 ? 15 dbc 868 mhz band ?? 48 ? 39 dbc spurious level @ f carrier f dataclk 315 and 434 mhz bands ?? 36 ? 24 dbc 868 mhz band ? 29 ? 17 dbc spurious level @ f carrier f reference 315 mhz band ?? 37 ? 30 dbc 434 mhz band ?? 44 ? 34 dbc 868 mhz band ?? 37 ? 27 dbc spurious level @ f carrier /2 315 mhz bands ?? 62 ? 53 dbc 434 mhz bands ?? 80 ? 60 dbc 868 mhz band ?? 45 ? 39 dbc rf spectrum 434 mhz bands see figure 17-1 , figure 17-2 , and figure 17-3 ? phase noise 315 and 434 mhz bands, 175 khz from f carrier ?? 75 ? 68 dbc/hz 868 mhz band, 175 khz from f carrier ?? 73 ? 66 dbc/hz pll lock-in time, t pll_lock_in f carrier within 30 khz from the final value, crystal series resistor = 150 ? ? 350 1500 s xtal1 input capacitance ? 12pf crystal resistance ? 40 200 ? modulation depth 75 90 ? dbc data rate ?? 10 kbd ? continued ? parameter test conditions and comments min typ max unit
advance information MC68HC908RF2 ? rev. 1 242 preliminary electrical specifications motorola preliminary electrical specifications figure 17-1. rf spectrum at 434-mhz frequency band displayed with a 5-mhz span microcontroller interfaces input low voltage pins band, mode, enable, and data 0 ? 0.3 x v cc v input high voltage 0.7 x v cc ? v cc v input hysteresis voltage ?? 150 mv input current pins band, mode, data @ high level ?? 100 na enable pulldown resistor ? 180 ? k ? dataclk output low voltage c load = 2 pf 0 ? 0.25 x v cc v dataclk output high voltage 0.75 x v cc ? v cc v dataclk rising time c load = 2 pf, measured from 20% to 80% of the voltage swing ? 250 500 ns dataclk falling time ? 150 400 ns dataclk settling time, t dataclk_settling 45 < duty cycle f dataclk < 55% ? 800 1800 s parameter test conditions and comments min typ max unit resolution bandwidth: 100 khz resolution bandwidth: 30 khz
preliminary electrical specifications uhf transmitter module MC68HC908RF2 ? rev. 1 advance information motorola preliminary electrical specifications 243 figure 17-2. rf spectrum at 434-mhz frequency band displayed with a 50-mhz span figure 17-3. rf spectrum at 434-mhz frequency band displayed with a 1.5-ghz span
advance information MC68HC908RF2 ? rev. 1 244 preliminary electrical specifications motorola preliminary electrical specifications 17.9.2 uhf module output power measurement the rf output levels given in the 17.9.1 uhf module electrical characteristics are measured whith a 50- ? load directly connected to the pin rfout as shown in figure figure 17-4 . this wideband coupling method gives results independant of the application. figure 17-4. output power measurement configurations the configuration shown in figure 17-5 (a) provides a better efficiency in terms of output power and harmonics rejection. schematic in figure 17-5 (b) gives the equivalent circuit of the pin rfout and impeder as well as the matching network components for 434-mhz frequency band. note: note that the impeder is moved to the load side to decrease its influence (similar to dc bias through the antenna). figure 17-6 gives the output power versus the r ext resistor value, in both cases with 50- ? load and with matching network. rfout rf output 50 ? 100 pf impeder: tdk mmz1608y102cta00 v cc
preliminary electrical specifications uhf transmitter module MC68HC908RF2 ? rev. 1 advance information motorola preliminary electrical specifications 245 figure 17-5. ouput characteristic and matching network for 434-mhz frequency band figure 17-6. output power at 434-mhz frequency band versus r ext value rfout rf output 50 ? impeder: tdk mmz1608y102cta00 v cc matching network c 0 r 0 r i r l l 1 1.5 pf 250 ? 3 k ? 50 ? matching 330 pf c 3 39 nh rfout pin load impeder (a) (b) network rfout level (dbm) 8 6 4 2 0 ? 2 ? 4 ? 6 6 9 12 15 18 21 24 r ext (k ? ) output power on 50 ? load (dbm) output power when matched (dbm) ? 0.35 db/k ? # ? 0.35 ma/k ? r ext specified range output power measurement in typical conditions (434 mhz ? v cc = 3 v ? 25 c)
advance information MC68HC908RF2 ? rev. 1 246 preliminary electrical specifications motorola preliminary electrical specifications 17.10 control timing 17.11 internal oscillator characteristics characteristic symbol min max unit bus operating frequency v dd = 3.0 v 10% v dd = 2.0 v 10% f bus 32 k 32 k 4.0 m 2.0 m hz reset pulse width low t rl 1.5 ? t cyc irq interrupt pulse width low (edge-triggered) t ilhi 1.5 ? t cyc irq interrupt pulse period t ilil note 4 ? t cyc 16-bit timer (note 2) input capture pulse width (note 3) input capture period input clock pulse width t th, t tl t tltl t tch , t tcl 2 note 4 (1/f op ) + 5 ? ? ? t cyc t cyc ns notes: 1. v dd = 1.8 v to 3.3 v, v ss = 0 vdc, t a = ? 40 o c to +85 o c, unless otherwise noted 2. the 2-bit timer prescaler is the limiting factor in determining timer resolution. 3. refer to table 15-3. mode, edge, and level selection and supporting note. 4. the minimum period t tltl or t ilil should not be less than the number of cycles it takes to execute the capture interrupt service routine plus 2 t cyc . characteristic (1) symbol min typ max unit internal oscillator base frequency without trim (2) (3) f intosc 230.4 307.2 384.0 khz internal oscillator base frequency with trim (2) (3) f intosc(i) 291.8 307.2 322.6 khz internal oscillator multiplier (4) n1 ? 127 ? external clock option (5) 3 v 10% 2 v 10% f extosc 128 k 128 k ? ? 16 8 mhz 1. v dd = 1.8 v to 3.3 v, v ss = 0 vdc, t a = ? 40 o c to +85 o c, unless otherwise noted 2. internal oscillator is selectable through software for a maximum frequency. actual frequency will be multiplier (n) x base frequency. 3. f bus = ( f intosc / 4) x (internal oscillator multiplier) 4. multiplier must be chosen to limit the maximum bus frequency to the maximum listed in 17.10 control timing . 5. no more than 10% duty cycle deviation from 50%
preliminary electrical specifications lvi characteristics MC68HC908RF2 ? rev. 1 advance information motorola preliminary electrical specifications 247 17.12 lvi characteristics characteristic (1) 1. the lvi samples v dd , v lvr , and v lvs are v dd voltages. 2. symbol min typ max unit lvi low battery sense voltage (1) v lvs 1.90 2.00 2.15 v lvi trip voltage (1) v lvr 1.76 1.85 2.00 v lvi trip voltage hysteresis h lvr 50 70 90 mv v dd slew rate ? rising sr r ?? 0.05 v/ s v dd slew rate ? falling sr f ?? 0.10 v/ s response time ? sr sr max t resp ?? 6.0 s response time ? sr > sr max t resp ?? see note 2 s enable time (enable to output transition) t en ?? 50 s v dd v lvr ? sr max ----------------------------------- v dd v lvr ? sr ----------------------------------- ? ?? ?? ?? 1.5 +
advance information MC68HC908RF2 ? rev. 1 248 preliminary electrical specifications motorola preliminary electrical specifications 17.13 memory characteristics characteristic symbol min typ max unit ram data retention voltage v rdr 1.3 ?? v flash pages per row ? 8 ? 8 pages flash bytes per page ? 1 ? 1bytes flash read bus clock frequency f read (1) 1. f read is defined as the frequency range for which the flash memory can be read. 32 k ? 2.5 m hz flash charge pump clock frequency (see 4.5 flash 2ts charge pump frequency control ) f pump (2) 2. f pump is defined as the charge pump clock frequency required for program, erase, and margin read operations. 1.8 ? 2.5 mhz flash block/bulk erase time t erase 100 ?? ms flash row erase time t rowerase 30 ?? ms flash high voltage kill time t kill 200 ?? s flash return to read time t hvd 50 ?? s flash page program pulses fls pulses (3) 3. fls pulses is defined as the number of pulses used to program the flash using the required smart program algorithm. ?? 15 pulses flash page program step size t step (4) 4. t step is defined as the amount of time during one page program cycle that hven is held high. 1.0 ? 1.2 ms flash cumulative program time per row between erase cycles t row (5) 5. t row is defined as the cumulative time a row can see the program voltage before the row must be erased before further programming. ?? 8 page program cycles flash hven low to margin high time t hvtv 50 ?? s flash margin high to pgm low time t vtp 150 ?? s flash 2ts row program endurance (6) 6. the minimum row endurance value specifies each row of the flash 2ts memory is guaranteed to work for at least this many erase/program cycles. ? 10 4 - ? - ? cycles flash data retention time (7) 7. the flash is guaranteed to retain data over the entire temperature range for at least the minimum time specified. ? 10 - ? - ? years
MC68HC908RF2 ? rev. 1 advance information motorola mechanical specifications 249 advance information ? MC68HC908RF2 section 18. mechanical specifications 18.1 contents 18.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .249 18.3 32-pin lqfp package (case no. 873a) . . . . . . . . . . . . . . . .250 18.2 introduction this section gives dimensions for the 32-pin low-profile quad flat pack (lqfp). the following figure shows the latest package drawing at the time of this publication. to make sure that you have the latest package specifications, contact one of the following:  local motorola sales office  worldwide web (wwweb) at http://www.motorola.com/mcu/ follow worldwide web on-line instructions to retrieve the current mechanical specifications.
advance information MC68HC908RF2 ? rev. 1 250 mechanical specifications motorola mechanical specifications 18.3 32-pin lqfp package (case no. 873a) detail y a s1 v b 1 8 9 17 25 32 ae ae p detail y base n j d f metal section ae ? ae g seating plane r q  w k x 0.250 (0.010) gauge plane e c h detail ad notes: 1. dimensioning and tolerancing per ansi y14.5m, 1982. 2. controlling dimension: millimeter. 3. datum plane ? ab ? is located at bottom of lead and is coincident with the lead where the lead exits the plastic body at the bottom of the parting line. 4. datums ? t ? , ? u ? , and ? z ? to be determined at datum plane ? ab ? . 5. dimensions s and v to be determined at seating plane ? ac ? . 6. dimensions a and b do not include mold protrusion. allowable protrusion is 0.250 (0.010) per side. dimensions a and b do include mold mismatch and are determined at datum plane ? ab ? . 7. dimension d does not include dambar protrusion. dambar protrusion shall not cause the d dimension to exceed 0.520 (0.020). 8. minimum solder plate thickness shall be 0.0076 (0.0003). 9. exact shape of each corner may vary from depiction. dim a min max min max inches 7.000 bsc 0.276 bsc millimeters b 7.000 bsc 0.276 bsc c 1.400 1.600 0.055 0.063 d 0.300 0.450 0.012 0.018 e 1.350 1.450 0.053 0.057 f 0.300 0.400 0.012 0.016 g 0.800 bsc 0.031 bsc h 0.050 0.150 0.002 0.006 j 0.090 0.200 0.004 0.008 k 0.500 0.700 0.020 0.028 m 12 ref 12 ref n 0.090 0.160 0.004 0.006 p 0.400 bsc 0.016 bsc q 1 5 1 5 r 0.150 0.250 0.006 0.010 v 9.000 bsc 0.354 bsc v1 4.500 bsc 0.177 bsc   detail ad a1 b1 v1 4x s 4x b1 3.500 bsc 0.138 bsc a1 3.500 bsc 0.138 bsc s 9.000 bsc 0.354 bsc s1 4.500 bsc 0.177 bsc w 0.200 ref 0.008 ref x 1.000 ref 0.039 ref 9 ? t ? ? z ? ? u ? t ? u 0.20 (0.008) z ac t ? u 0.20 (0.008) z ab 0.10 (0.004) ac ? ac ? ? ab ? m  8x ? t ? , ? u ? , ? z ? t ? u m 0.20 (0.008) z ac
MC68HC908RF2 ? rev. 1 advance information motorola ordering information 251 advance information ? MC68HC908RF2 section 19. ordering information 19.1 contents 19.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .251 19.3 mc order numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .251 19.2 introduction this section contains ordering numbers for the MC68HC908RF2. 19.3 mc order numbers table 19-1. mc order numbers mc order number (1) 1. fa = low-profile quad flat pack (lqfp) operating temperature range MC68HC908RF2cfa ? 40 c to +85 c
advance information MC68HC908RF2 ? rev. 1 252 ordering information motorola ordering information
blank
mc 68hc08as60 technical data how to reach us: usa/europe/locations not listed: motorola literature distribution p.o. box 5405 denver, colorado 80217 1-303-675-2140 1-800-441-2447 technical information center: 1-800-521-6274 japan: motorola japan ltd. sps, technical information center 3-20-1, minami-azabu, minato-ku tokyo 106-8573 japan 81-3-3440-3569 asia/pacific: motorola semiconductors h.k. ltd. silicon harbour centre 2 dai king street tai po industrial estate tai po, n.t., hong kong 852-26668334 home page: http://www.motorola.com/semiconductors/ q4/00 rev 1 mc68hc9 0 8 rf2 / d rev 1


▲Up To Search▲   

 
Price & Availability of MC68HC908RF2

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X